You are here: Wiki>Projects Web>RIESGOS>SimpleQuakeMapAlgorithm (25 Jan 2018, BenjaminPross)Edit Attach

RIESGOS Simple QuakeMap Algorithm Client Tutorial


Introduction

This page shows how to produce a simplyfied QuakeMap with the 52°North wps-js client.

The org.n52.wps.extension.QuakemapAlgorithm was created by 52°North to demonstrate the capabilities of the WPS together with a Web-based client. The process is accessible via a REST proxy: http://geoprocessing.demo.52north.org:8080/wps-proxy/processes/org.n52.wps.extension.QuakemapAlgorithm

The URL will return the following:

{
   "ProcessOffering": {
      "Process": {
         "Title": "Quakemap algorithm",
         "Identifier": "org.n52.wps.extension.QuakemapAlgorithm",
         "Input": [{
            "Title": "earthquake information",
            "Identifier": "input",
            "ComplexData": {
               "Format": [{
                  "_default": "true",
                  "_mimeType": "application/vnd.geo+json"
               },
               {
                  "_default": "false",
                  "_mimeType": "text/xml",
                  "_schema": "http://quakeml.org/schema/xsd/QuakeML-1.2.xsd"
               }]
            },
            "_minOccurs": "1",
            "_maxOccurs": "1"
         }],
         "Output": [{
            "Title": "Buffers with decreasing magnitudes",
            "Identifier": "output",
            "ComplexData": {
               "Format": [{
                  "_default": "true",
                  "_mimeType": "application/vnd.geo+json"
               },
               {
                  "_default": "false",
                  "_mimeType": "text/xml",
                  "_schema": "http://earthquake.usgs.gov/eqcenter/shakemap/xml/schemas/shakemap.xsd"
               }]
            }
         }]
      },
      "_processVersion": "1.1",
      "_jobControlOptions": "sync-execute async-execute",
      "_outputTransmission": "value reference",
      "execute-url": "http://geoprocessing.demo.52north.org:8080/wps-proxy/processes/org.n52.wps.extension.QuakemapAlgorithm/jobs"
   }
}

Note that the process currently only can consume and produce GeoJSON. The other input formats are listed there for demonstration purposes. Example Execute request:

{
    "Execute": {
        "Identifier": "org.n52.wps.extension.QuakemapAlgorithm",
        "Input": [
            {
            "ComplexData": {
                    "_mimeType": "application/vnd.geo+json",
                    "_text": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"magnitude\": 7.8},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-437.431640625,-30.56226095049943]}}]}"
            },
            "_id": "input"
            }
        ],
        "output":[{
            "_mimeType": "application/vnd.geo+json",
            "_id": "output",
            "_transmission": "value"
        }],
        "_service": "WPS",
        "_version": "2.0.0"
    }
}

Note that the wps-js client currently used the WPS XML binding (version 1.0 and 2.0). Support for the REST binding is in alpha.

How to execute the process using the wps-js client

You can find the wps-js client here: http://geoprocessing.demo.52north.org:8080/wps-js-client/

After loading the URL, you will see the following (language dependin on your browser settings):

start.png

The map is by default centered on the 52°North headquarters!

The SimpleQuekamapAlgorithm runs in a WPS on the same server, if you select it from the dropdown list, a GetCapabilities request is sent to check the availability of the WPS:

select-wps.png

You can inspect the capabilities and see for example, who is responsible for the WPS and whether there are any restrictions.

We will skip this step and will directly check out the list of processes:

select-process.png

The WPS offers just the Quakemap algorithm and a process for checking annotated R-scripts (see WPS4R for more information).

We select the quakemap algorithm, a DescribeProcess request is sent to the WPS and we immediately are presented some additional information about the process, like a description of inputs and outputs:

select-process-2.png

After a process was selected, the Execute tab of the client will be activated and we can specify the execute parameters, e.g. inputs:

select-input.png

For the quakemap algorithm, there is only one input that you can choose from the input dropdown list via the input title.

For WPS process inputs, you need to specify a data format. The MIME type needs to be specified, a schema and data encoding specification is optional:

select-input-format.png

After choosing the format, you can specify how you want to send the input data to the WPS. The first option is to send it inline the XML execute request. If you choose this option, you can either upload a file to the client or paste your data in a textfield. The second option is to specify a remote location that the WPS can download the data from. A specialty of the wps-js client is that if you choose GeoJSON (application/vnd.geo+json, specified by IANA) as MIME type, you are able to digitalize your input features as a third option:

digitalize-input.png

We will digitalize the input. As we need a point, we need to choose the marker symbol from the map tools:

digitalize-input-2.png

Now we can simply click somewhere on the map and the point feature will be created and the GeoJSON will be automatically pasted in the Complex Payload text field, where we can modify it:

digitalize-input-3.png

The quakemap algorithm needs a property called magnitude for each feature. We can simply add the following to the properties element of the GeoJSON: "magnitude": 7.8

digitalize-input-4.png

Now just click on Add Input and we can proceed to the output specification:

select-output.png

Again, there is only one output available that you can choose via its title. Also you need to specify the desired data format and the so called transmission mode. Here you can decide, whether you want the result inline in the execute response XML or as a reference to a Web-accessible resource:

select-output-2.png

We choose GeoJSON for the format and the transmission mode value, as the result of the process can then directly be visualized in the client:

select-output-3.png

After a click on Add Output the madatory parameters of the execute request are set. You can specify additional parameters, e.g. the execution mode (synchronous (sync-execute) for a short processing time or asynchronous (async-execute) for long running processes). For the Quakemap algorithm, the default synchronous execution mode fits well. For the response format, we'll also leave the default value of document (i.e. the result will be returned wrapped in the execute response XML. The other option is raw, which is useful e.g. for binary outputs):

optionally-configure-execute-request.png

Now all we need to do ist click on Perform Execute Request and the XML request will be created and it will be sent to the WPS. As this really is just a demo-process, it should take only a few seconds. The result will be added to the map and the map will be zoomed to it:

process-result-1.png

Also, the GeoJSON will be displayed. If we zoom out a bit, we can see the complete result. Again, this is a demo process with no claim to model a correct quakemap whatsoever:

process-result-2.png

Thanks for reading this HowTo, I hope you enjoyed it. If you have any comments or questions, feel free to send my a note: b.pross @52north.org
Topic attachments
I Attachment Action Size Date Who Comment
digitalize-input-2.pngpng digitalize-input-2.png manage 98 K 24 Jan 2018 - 16:10 BenjaminPross  
digitalize-input-3.pngpng digitalize-input-3.png manage 98 K 25 Jan 2018 - 10:02 BenjaminPross  
digitalize-input-4.pngpng digitalize-input-4.png manage 97 K 25 Jan 2018 - 10:03 BenjaminPross  
digitalize-input.pngpng digitalize-input.png manage 96 K 24 Jan 2018 - 16:09 BenjaminPross  
optionally-configure-execute-request.pngpng optionally-configure-execute-request.png manage 89 K 25 Jan 2018 - 10:03 BenjaminPross  
process-result-1.pngpng process-result-1.png manage 67 K 25 Jan 2018 - 10:05 BenjaminPross  
process-result-2.pngpng process-result-2.png manage 121 K 25 Jan 2018 - 10:05 BenjaminPross  
select-input-format.pngpng select-input-format.png manage 93 K 25 Jan 2018 - 10:05 BenjaminPross  
select-input.pngpng select-input.png manage 89 K 25 Jan 2018 - 10:05 BenjaminPross  
select-output-2.pngpng select-output-2.png manage 94 K 25 Jan 2018 - 10:07 BenjaminPross  
select-output-3.pngpng select-output-3.png manage 94 K 25 Jan 2018 - 10:07 BenjaminPross  
select-output.pngpng select-output.png manage 91 K 25 Jan 2018 - 10:06 BenjaminPross  
select-process-2.pngpng select-process-2.png manage 766 K 25 Jan 2018 - 10:09 BenjaminPross  
select-process.pngpng select-process.png manage 765 K 25 Jan 2018 - 10:08 BenjaminPross  
select-wps.pngpng select-wps.png manage 778 K 25 Jan 2018 - 10:09 BenjaminPross  
start.pngpng start.png manage 773 K 25 Jan 2018 - 10:10 BenjaminPross  
Topic revision: r4 - 25 Jan 2018 13:36:26, BenjaminPross
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback