Ian Turton, Astun Technology
@ijturton
Web GIS is cool if you want to look at a map and may be query points on it.
Or, in other words, I can write the process in Java (or Python) and run it on my server (hiding the PostGIS credentials) and have my Web GIS access it (asynchronously) via a well known API.
@DescribeProcess(title = "Pick and Union", description = "Return the union of the features that fulfil the provided filter and the geometry passed in.") @DescribeResult(name = "result", description = "The union of the selected features and the geometry", primary = true, type = Geometry.class) static public Geometry getFeatures( @DescribeParameter(name = "collection", description = "The features to be searched", min = 1) SimpleFeatureCollection collection, @DescribeParameter(name = "filter", description = "the filter to be used for the search (CQL or OGC)", min = 1) String filter, @DescribeParameter(name = "geometry", description = "Optional geometry to union with the results of the filter.", min = 0) Geometry geom, @DescribeParameter(name = "subtract", description = "If true then the matching geometries are removed from geometry, default false", min = 0) Boolean subtract, @DescribeParameter(name = "organisation", description = "The name of the organisation making the request, default none", min = 0) String organisation) {
As if by magic your WPS appears in the list of processes with all of the arguments documented.
<wps:Execute version="1.0.0" service="WPS"> <ows:Identifier>PickerAndUnion:getFeatures</ows:Identifier> <wps:DataInputs> <wps:Input> <ows:Identifier>collection</ows:Identifier> <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST"> <wps:Body> <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:astun="http://astuntechnology.com/"> <wfs:Query typeName="astun:topographicarea"/> </wfs:GetFeature> </wps:Body> </wps:Reference> </wps:Input> <wps:Input> <ows:Identifier>filter</ows:Identifier> <wps:Data> <wps:LiteralData>INSERT FILTER</wps:LiteralData> </wps:Data> </wps:Input> <wps:Input> <ows:Identifier>geometry</ows:Identifier> <wps:Data> <wps:ComplexData mimeType="application/json"> <![CDATA[insert json geom]]> </wps:ComplexData> </wps:Data> </wps:Input> </wps:DataInputs> <wps:ResponseForm> <wps:RawDataOutput mimeType="application/json"> <ows:Identifier>result</ows:Identifier> </wps:RawDataOutput> </wps:ResponseForm> </wps:Execute>
- unpack shapefile and convert to feature/geometry
- connect to PostGIS database
- create a filter for each rule
- extract matching features from 30 layers
- produce PDF map (WMS call)
- add a sheet to Excel spreadsheet (Apache POI)
- finally, zip output up and notify client
Actually, implemented as two WPS processes
- upload, unpack and copy shapefile to PostGIS
- Create a report based on that feature (using a preprepared template)
E.ON's £1.3 Billion 400MW Off-shore windfarm
If you are looking for an easy way to make your web map application smarter, without tying yourself down to a back service you can use a WPS to move complex business logic to the server.
Space | Forward |
---|---|
Right, Down, Page Down | Next slide |
Left, Up, Page Up | Previous slide |
G | Go to slide number |
P | Open presenter console |
H | Toggle this help |