geojson parser

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

geojson parser

sammeek
Hi Board,

I'm having an issue with the application/json parser for the WPS. I'm using the java client libraries and when I pass it a reference with outputFormat=application/json I get the following:

java.lang.Exception: Exception: <ows:ExceptionReport version="1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Error. No applicable parser found for schema="null", mimeType="application/json", encoding="null"</ows:ExceptionText>
  </ows:Exception>
  <ows:Exception exceptionCode="JAVA_StackTrace">
    <ows:ExceptionText>org.n52.wps.server.ExceptionReport: Error. No applicable parser found for schema="null", mimeType="application/json", encoding="null"
        at org.n52.wps.server.request.InputHandler.handleComplexValueReference(InputHandler.java:1160)
        at org.n52.wps.server.request.InputHandler.<init>(InputHandler.java:167)
        at org.n52.wps.server.request.InputHandler.<init>(InputHandler.java:88)
        at org.n52.wps.server.request.InputHandler$Builder.build(InputHandler.java:119)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:662)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)</ows:ExceptionText>
  </ows:Exception>

application/json is available and active in my parser list and I am using the following in the client:

 else if (inputValue instanceof String) {
                                System.out.println("inputValue " + inputValue);
                                        executeBuilder
                                                        .addComplexDataReference(
                                                                        inputName,
                                                                        (String) inputValue,
                                                                        null,
                                                                        null, "application/json");
                                }
}

Thanks

Sam
Reply | Threaded
Open this post in threaded view
|

Re: geojson parser

BenjaminPross
Hi Sam,

I would suspect that the mime type is not supported by the process.
Could you verify that the mime type appears in the format list of the
input in the process description?

Cheers,

Benjamin

Am 26.03.2015 um 13:37 schrieb sammeek:

> Hi Board,
>
> I'm having an issue with the application/json parser for the WPS. I'm using
> the java client libraries and when I pass it a reference with
> outputFormat=application/json I get the following:
>
> java.lang.Exception: Exception: <ows:ExceptionReport version="1.0.0"
> xmlns:ows="http://www.opengis.net/ows/1.1">
>    <ows:Exception exceptionCode="NoApplicableCode">
>      <ows:ExceptionText>Error. No applicable parser found for schema="null",
> mimeType="application/json", encoding="null"</ows:ExceptionText>
>    </ows:Exception>
>    <ows:Exception exceptionCode="JAVA_StackTrace">
>      <ows:ExceptionText>org.n52.wps.server.ExceptionReport: Error. No
> applicable parser found for schema="null", mimeType="application/json",
> encoding="null"
> at
> org.n52.wps.server.request.InputHandler.handleComplexValueReference(InputHandler.java:1160)
> at org.n52.wps.server.request.InputHandler.&lt;init>(InputHandler.java:167)
> at org.n52.wps.server.request.InputHandler.&lt;init>(InputHandler.java:88)
> at
> org.n52.wps.server.request.InputHandler$Builder.build(InputHandler.java:119)
> at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:662)
> at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)</ows:ExceptionText>
>    </ows:Exception>
>
> application/json is available and active in my parser list and I am using
> the following in the client:
>
>   else if (inputValue instanceof String) {
>                                   System.out.println("inputValue " +
> inputValue);
>                                          executeBuilder
>                                                        
> .addComplexDataReference(
>                                                                        
> inputName,
>                                                                        
> (String) inputValue,
>                                                                        
> null,
>                                                                        
> null, "application/json");
>                                  }
> }
>
> Thanks
>
> Sam
>
>
>
> --
> View this message in context: http://geoprocessing.forum.52north.org/geojson-parser-tp4026022.html
> Sent from the 52° North - Geoprocessing Community Forum mailing list archive at Nabble.com.
> _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines


--
Benjamin Proß
Software Engineer
52°North Geoprocessing Community

52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
Fon: +49-(0)-251–396371-42
Fax: +49-(0)-251–396371-11
[hidden email]
http://52north.org/

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849

_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: geojson parser

sammeek
Hi Benjamin

I extend AbstractAlgorithm and write the process descriptions manually. I have included the following:

<Input maxOccurs="1" minOccurs="1">
<ows:Identifier>inputObservations</ows:Identifier>
<ows:Title>inputObservations</ows:Title>
<ComplexData>
<Default>
<Format>
<MimeType>text/xml; subtype=gml/3.1.1</MimeType>
<Schema>http://schemas.opengis.net/gml/3.1.1/base/gml.xsd</Schema>
</Format>
</Default>
<Supported>
<Format>
<MimeType>text/xml; subtype=gml/3.1.1</MimeType>
<Schema>http://schemas.opengis.net/gml/3.1.1/base/gml.xsd</Schema>
</Format>
<Format>
<MimeType>application/json</MimeType>
</Format>
<Format>
<MimeType>text/xml; subtype=gml/3.1.0</MimeType>
<Schema>
http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
</Schema>
</Format>
</Supported>
</ComplexData>
</Input>

The input should allow geojson, correct?

Thanks

Sam
Reply | Threaded
Open this post in threaded view
|

Re: geojson parser

BenjaminPross
Looks good, thats one important part to enable the mime type.
Could you check the process class, especially the supported data binding
for the "inputObservations" input?
If it supports GTVectorDataBinding then you just need to add the
following parser to the wps_config_geotools:

             <Parser name="GeoJSONParser"
className="org.n52.wps.io.datahandler.parser.GeoJSONParser"
                 active="true">
                 <Format mimetype="application/json"/>
             </Parser>

Hope this helps.

Cheers,

Benjamin

Am 27.03.2015 um 10:04 schrieb sammeek:

> Hi Benjamin
>
> I extend AbstractAlgorithm and write the process descriptions manually. I
> have included the following:
>
> <Input maxOccurs="1" minOccurs="1">
> <ows:Identifier>inputObservations</ows:Identifier>
> <ows:Title>inputObservations</ows:Title>
> <ComplexData>
> <Default>
> <Format>
> <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
> <Schema>http://schemas.opengis.net/gml/3.1.1/base/gml.xsd</Schema>
> </Format>
> </Default>
> <Supported>
> <Format>
> <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
> <Schema>http://schemas.opengis.net/gml/3.1.1/base/gml.xsd</Schema>
> </Format>
> <Format>
> <MimeType>application/json</MimeType>
> </Format>
> <Format>
> <MimeType>text/xml; subtype=gml/3.1.0</MimeType>
> <Schema>
> http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
> </Schema>
> </Format>
> </Supported>
> </ComplexData>
> </Input>
>
> The input should allow geojson, correct?
>
> Thanks
>
> Sam
>
>
>
> --
> View this message in context: http://geoprocessing.forum.52north.org/geojson-parser-tp4026022p4026027.html
> Sent from the 52° North - Geoprocessing Community Forum mailing list archive at Nabble.com.
> _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines


--
Benjamin Proß
Software Engineer
52°North Geoprocessing Community

52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
Fon: +49-(0)-251–396371-42
Fax: +49-(0)-251–396371-11
[hidden email]
http://52north.org/

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849

_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: geojson parser

sammeek
In reply to this post by sammeek
Hi Benjamin,

That solved it.

Thanks

Sam
Reply | Threaded
Open this post in threaded view
|

Re: geojson parser

sammeek
Hi Benjamin,

Related to this query is the use of unicode characters ()?#! in wfs requests. I am trying to run the WPS using a URL as an input with the parser set to application/json where some of the field names include these illegal characters. The reason for doing this is that Geojson supports the illegal characters where as GML does not (at least the geojson will appear in the browser where the GML will not).

However with the request setup with application/json, I get the following error:

java.lang.Exception: Exception: <ows:ExceptionReport version="1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Error while executing the embedded process for: pillar.authoritativedata.PointInPolygon</ows:ExceptionText>
  </ows:Exception>
  <ows:Exception exceptionCode="JAVA_StackTrace">
    <ows:ExceptionText>org.n52.wps.server.ExceptionReport: Error while executing the embedded process for: pillar.authoritativedata.PointInPolygon
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:716)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: org.n52.wps.server.ExceptionReport: Could not create Inline Complex Data from the process result
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:872)
        at org.n52.wps.server.request.ExecuteRequest.updateStatusSuccess(ExecuteRequest.java:841)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:694)
        ... 5 more
Caused by: org.n52.wps.server.ExceptionReport: Could not create Inline Complex Data from the process result
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:152)
        at org.n52.wps.server.response.ExecuteResponseBuilder.generateComplexDataOutput(ExecuteResponseBuilder.java:330)
        at org.n52.wps.server.response.ExecuteResponseBuilder.update(ExecuteResponseBuilder.java:165)
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:858)
        ... 7 more
Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
        at org.apache.xerces.dom.CoreDocumentImpl.checkQName(Unknown Source)
        at org.apache.xerces.dom.ElementNSImpl.setName(Unknown Source)
        at org.apache.xerces.dom.ElementNSImpl.<init>(Unknown Source)
        at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source)
        at org.geotools.xml.impl.ElementEncodeExecutor.<init>(ElementEncodeExecutor.java:63)
        at org.geotools.xml.impl.ElementEncoder.encode(ElementEncoder.java:84)
        at org.geotools.xml.Encoder.encode(Encoder.java:1138)
        at org.geotools.xml.Encoder.encode(Encoder.java:860)
        at org.geotools.xml.Encoder.encode(Encoder.java:584)
        at org.n52.wps.io.datahandler.generator.GML3BasicGenerator.writeToStream(GML3BasicGenerator.java:128)
        at org.n52.wps.io.datahandler.generator.GML3BasicGenerator.generateStream(GML3BasicGenerator.java:141)
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:123)
        ... 10 more</ows:ExceptionText>
  </ows:Exception>
  <ows:Exception exceptionCode="JAVA_RootCause">
    <ows:ExceptionText>org.n52.wps.server.ExceptionReport: Could not create Inline Complex Data from the process result</ows:ExceptionText>
    <ows:ExceptionText>java.lang.RuntimeException: org.n52.wps.server.ExceptionReport: Could not create Inline Complex Data from the process result
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:872)
        at org.n52.wps.server.request.ExecuteRequest.updateStatusSuccess(ExecuteRequest.java:841)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:694)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.n52.wps.server.ExceptionReport: Could not create Inline Complex Data from the process result
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:152)
        at org.n52.wps.server.response.ExecuteResponseBuilder.generateComplexDataOutput(ExecuteResponseBuilder.java:330)
        at org.n52.wps.server.response.ExecuteResponseBuilder.update(ExecuteResponseBuilder.java:165)
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:858)
        ... 7 more
Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
        at org.apache.xerces.dom.CoreDocumentImpl.checkQName(Unknown Source)
        at org.apache.xerces.dom.ElementNSImpl.setName(Unknown Source)
        at org.apache.xerces.dom.ElementNSImpl.<init>(Unknown Source)
        at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source)
        at org.geotools.xml.impl.ElementEncodeExecutor.<init>(ElementEncodeExecutor.java:63)
        at org.geotools.xml.impl.ElementEncoder.encode(ElementEncoder.java:84)
        at org.geotools.xml.Encoder.encode(Encoder.java:1138)
        at org.geotools.xml.Encoder.encode(Encoder.java:860)
        at org.geotools.xml.Encoder.encode(Encoder.java:584)
        at org.n52.wps.io.datahandler.generator.GML3BasicGenerator.writeToStream(GML3BasicGenerator.java:128)
        at org.n52.wps.io.datahandler.generator.GML3BasicGenerator.generateStream(GML3BasicGenerator.java:141)
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:123)
        ... 10 more</ows:ExceptionText>
  </ows:Exception>

Does this mean that the WPS does not support importing of illegal characters?

Sam