0

I am trying to execute a buffer operation using geoserver 2.8.3, but i'd rather use json than GML to send this request. Is it possible to perform an Execute operation this way?

The describe process request contains this little snippet for data input

            <Input maxOccurs="1" minOccurs="1">
            <ows:Identifier>geom</ows:Identifier>
            <ows:Title>geom</ows:Title>
            <ows:Abstract>Input geometry</ows:Abstract>
            <ComplexData>
                <Default>
                    <Format>
                        <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
                    </Format>
                </Default>
                <Supported>
                    <Format>
                        <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
                    </Format>
                    <Format>
                        <MimeType>text/xml; subtype=gml/2.1.2</MimeType>
                    </Format>
                    <Format>
                        <MimeType>application/wkt</MimeType>
                    </Format>
                    <Format>
                        <MimeType>application/json</MimeType>
                    </Format>
                    <Format>
                        <MimeType>application/gml-3.1.1</MimeType>
                    </Format>
                    <Format>
                        <MimeType>application/gml-2.1.2</MimeType>
                    </Format>
                </Supported>
            </ComplexData>
        </Input>

which gives me some hope that a full json request might be possible but it currently doesn't work when i try it, and i can't seem to find any working examples out there.

The json data i used unsuccessfully is

{
    "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 ../../xsd/wpsAll.xsd",
        "ows:Identifier": "JTS:buffer",
        "wps:DataInputs": {
        "wps:Input": [
            {
                "ows:Identifier": "geom",
                "wps:Data": {
                    "wps:ComplexData": {
                        "-mimeType": "text/xml; subtype=gml/3.1.1",
                        "#cdata-section": "POINT(-9128198.245048434 5311971.846945471)"
                    }
                }
            },
            {
                "ows:Identifier": "distance",
                "wps:Data": { "wps:LiteralData": "1000" }
            },
            {
                "ows:Identifier": "quadrantSegments",
                "wps:Data": { "wps:LiteralData": "0" }
            },
            {
                "ows:Identifier": "capStyle",
                "wps:Data": { "wps:LiteralData": "flat" }
            }
        ]
    },
    "wps:ResponseForm": {
        "wps:RawDataOutput": {
            "-mimeType": "text/xml; subtype=gml/3.1.1",
                "ows:Identifier": "result"
            }
        }
    }
}
0

AFAIK WPS only supports XML as the request format, the formats you are seeing in the DescribeProcess document are for the encoding of the geometry element. So your request should look something like:

<?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>JTS:buffer</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>geom</ows:Identifier>
      <wps:Data>
        <wps:ComplexData mimeType="application/json"><![CDATA[{"type": "Point", "coordinates": [-9128198.245048434,5311971.846945471]}]]></wps:ComplexData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>distance</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>1000</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>quadrantSegments</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>10</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>capStyle</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>Round</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="application/json">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>

Which will give a result like:

{"type":"Polygon","coordinates":[[[-9127198.245,5311971.8469],[-9127210.5567,5311815.4125],[-9127247.1885,5311662.83],[-9127307.2385,5311517.8564],[-9127389.2281,5311384.0617],[-9127491.1383,5311264.7402],[-9127610.4598,5311162.83],[-9127744.2545,5311080.8404],[-9127889.2281,5311020.7904],[-9128041.8106,5310984.1586],[-9128198.245,5310971.8469],[-9128354.6795,5310984.1586],[-9128507.262,5311020.7904],[-9128652.2355,5311080.8404],[-9128786.0303,5311162.83],[-9128905.3518,5311264.7402],[-9129007.262,5311384.0617],[-9129089.2516,5311517.8564],[-9129149.3016,5311662.83],[-9129185.9334,5311815.4125],[-9129198.245,5311971.8469],[-9129185.9334,5312128.2814],[-9129149.3016,5312280.8639],[-9129089.2516,5312425.8374],[-9129007.262,5312559.6322],[-9128905.3518,5312678.9537],[-9128786.0303,5312780.8639],[-9128652.2355,5312862.8535],[-9128507.262,5312922.9035],[-9128354.6795,5312959.5353],[-9128198.245,5312971.8469],[-9128041.8106,5312959.5353],[-9127889.2281,5312922.9035],[-9127744.2545,5312862.8535],[-9127610.4598,5312780.8639],[-9127491.1383,5312678.9537],[-9127389.2281,5312559.6322],[-9127307.2385,5312425.8374],[-9127247.1885,5312280.8639],[-9127210.5567,5312128.2814],[-9127198.245,5311971.8469]]]}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.