pq1
pq1

Reputation: 31

Geoserver WPS Execute Request

I have a GeoServer that I am trying to return a GeoJSON with my WPS with a web link but I am unsure how to.

The tutorial on the GeoServer website says to do a curl. I'm sure GeoServer can do this because it has a demo WPS builder and returns what I need. I'm using Leaflet to visualize the returned web link so it'd be nice to have it dynamically pulling rather than pointing to a uploaded file.

This is what I have. Any help is greatly appreciated.

http://localhost:8081/geoserver/ows?service=wps&version=1.0.0&request=Execute&identifier=vec:InclusionFeatureCollection&dataInputs=Layer=https://rawgit.com/pq1/772-Final/master/housesMetro.geojson&Layer=https://rawgit.com/pq1/772-Final/master/housesSchoolDistricts.geojson&Output=application/json

Upvotes: 3

Views: 1832

Answers (1)

Ian Turton
Ian Turton

Reputation: 10976

It may be that you need to use a POST request like

curl -v -u admin:geoserver -X POST -H "Content-type: xml" \
-d @test.xml \
http://localhost:4080/geoserver/wps\?request\=Execute\&service\=WPS\&version\=1.0.0

(obviously all on one line without \ if you use windows)

works for me where test.xml contains:

<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>vec:InclusionFeatureCollection</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>first</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:sf="http://www.openplans.org/spearfish">
            <wfs:Query typeName="sf:bugsites"/>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>second</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:sf="http://www.openplans.org/spearfish">
            <wfs:Query typeName="sf:restricted"/>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="application/json">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>

Upvotes: 3

Related Questions