Geospatial Portal SDK provides the facility to define and run WFS Queries. Using these WFS Queries result we can further do analysis like creating Charts which are dynamic and provide a graphical and logical presentation to the WFS Query.
The code snippet in this article uses Ext4 JS 4.1 library to draw the charts. A wide variety of HTML5 and JavaScript chart libraries are available online, and they can also be used in a similar way.
Version 2.2.1 of Ext JS is provided with Geospatial Portal SDK 2015. In order to be able to use the Ext4 JS 4.1 with the SDK, the ext-all.js JavaScript file is modified by replacing all instances of 'Ext.' to 'Ext4.'. This is done to prevent the version clash between the two versions of Ext JS libraries. The zip File:Extjs.zip (below in attachements) contains the modified library and other resources. Extract the zip to the SDK and reference the ext-all.js in the aspx page as below:
<script type="text/javascript" src="extjs/ext-all.js"></script>
In the aspx page add the following div element on which the chart is rendered.
<div id="wfsCharts"> </div>
Also add the following style tag in the aspx page.
<style type="text/css"> .white .x-window-body { background-color: white !important; } </style>
Place the following code snippet inside a js file and reference it in the aspx page. The code snippet is written to work on the US Sample Data WFS (http://demo.hexagongeospatial.com/GWM_WFS_NonTransactional/service.svc/get). To use any other WFS sources change the code accordingly (change URL, feature name, attribute names).
Note: Processing of WFS Query result takes time depending on network speed, latency and data size. For this prototype a message 'WFS Query data fetched successfully.' appears which means WFS query result has been processed and only NOW can the chart be created.
The above prototype is a simple example on how we can extend WFS query analysis into further analysis. A more generic and complete solution can be developed by taking care of the following points:
... and so on.
Information that could be useful for the above implementation:
Refer to Portal SDK 2015 documentation and run through the examples provided for these API's to understand how they work.