TransWikia.com

Geoserver: Running a WPS process asynchronously returns GML format always

Geographic Information Systems Asked by Faz B on April 13, 2021

I want to run a WPS process async, I’m sending the following request:

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" service="WPS" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
   <ows:Identifier>ras:Contour</ows:Identifier>
   <wps:DataInputs>
      <wps:Input>
         <ows:Identifier>data</ows:Identifier>
         <wps:Reference mimeType="image/tiff" xlink:href="http://geoserver/wcs" method="POST">
            <wps:Body>
               <wcs:GetCoverage service="WCS" version="1.1.1">
                  <ows:Identifier>tst:elevations</ows:Identifier>
                  <wcs:DomainSubset>
                     <ows:BoundingBox crs="http://www.opengis.net/gml/srs/epsg.xml#4326">
                        <ows:LowerCorner>30.0 28.0</ows:LowerCorner>
                        <ows:UpperCorner>30.2 28.2</ows:UpperCorner>
                     </ows:BoundingBox>
                  </wcs:DomainSubset>
                  <wcs:Output format="image/tiff" />
               </wcs:GetCoverage>
            </wps:Body>
         </wps:Reference>
      </wps:Input>
      <wps:Input>
         <ows:Identifier>interval</ows:Identifier>
         <wps:Data>
            <wps:LiteralData>100</wps:LiteralData>
         </wps:Data>
      </wps:Input>
      <wps:Input>
         <ows:Identifier>simplify</ows:Identifier>
         <wps:Data>
            <wps:LiteralData>1</wps:LiteralData>
         </wps:Data>
      </wps:Input>
   </wps:DataInputs>
   <wps:ResponseForm>
   <wps:ResponseDocument storeExecuteResponse="true" status="true"> 
         <wps:RawDataOutput mimeType="application/json">
            <ows:Identifier>result</ows:Identifier>
         </wps:RawDataOutput>
   </wps:ResponseDocument> 
   </wps:ResponseForm>
</wps:Execute>

Then I use GetExecutionStatus to get the status and the result of the above request.

http://localhost:8080/geoserver/ows?service=WPS&version=1.0.0&request=GetExecutionStatus&executionId=7bf07277-62fe-4a7d-a4e3-dd2b19a5582e

although I set the output mimetype to "application/json" as shown above, I got the result in GML format.

If I run the same request synchronously I get the result in json format.

What is the problem?

Here is a sample response:

<wps:ExecuteResponse xml:lang="en" service="WPS" serviceInstance="http://localhost:8080/geoserver/ows?" statusLocation="http://localhost:8080/geoserver/ows?service=WPS&version=1.0.0&request=GetExecutionStatus&executionId=d3f3a311-7576-464b-a683-7e13f76166b8" version="1.0.0">
<wps:Process wps:processVersion="1.0.0">
<ows:Identifier>ras:Contour</ows:Identifier>
<ows:Title>Contour</ows:Title>
<ows:Abstract>Computes contour lines at specified intervals or levels for the values in a raster.</ows:Abstract>
</wps:Process>
<wps:Status creationTime="2018-03-31T15:50:22.746Z">
<wps:ProcessSucceeded>Process succeeded.</wps:ProcessSucceeded>
</wps:Status>
<wps:ProcessOutputs>
<wps:Output>
<ows:Identifier>result</ows:Identifier>
<ows:Title>Contour line features.  Contour level is in value attribute.</ows:Title>
<wps:Data>
<wps:ComplexData mimeType="text/xml; subtype=wfs-collection/1.0">
<wfs:FeatureCollection>
<gml:boundedBy>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coord><gml:X>30.00013888888889</gml:X><gml:Y>28.000138696255206</gml:Y></gml:coord>
<gml:coord><gml:X>30.19986111111112</gml:X><gml:Y>28.19986130374481</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<feature:geotiff_coverage fid="0"><gml:boundedBy>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coord><gml:X>30.003364197530864</gml:X><gml:Y>28.19595647071376</gml:Y></gml:coord>
<gml:coord><gml:X>30.00625</gml:X><gml:Y>28.19986130374481</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<feature:the_geom>
<gml:LineString>
<gml:coordinates>30.00371913580247,28.19986130374481 30.00366452991454,28.19977595220315 30.003625283446716</gml:coordinates>
</gml:LineString>
</feature:the_geom>

One Answer

For who want the answer, you only have to change the output tag from <wps:RawDataOutput> to <wps:Output> like this:

<wps:ResponseDocument storeExecuteResponse="true" status="true"> 
   <wps:Output mimeType="application/json">
      <ows:Identifier>result</ows:Identifier>
   </wps:Output>
</wps:ResponseDocument>

Correct answer by abd0991 on April 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP