What can you send to the WPS

From Intamap

The INTAMAP Web Processing Service interface can seem very complex when you first look at it. However, with the help of this project you should be sending requests in no time!

Contents

Inputs

There are several inputs that you can send to the WPS to customise your experience - this section will tell you what you can send, what will be parsed and what will be ignored.

ObservationCollection

This is the only mandatory input. It should be encoded as an Observations & Measurements (O&M) ObservationCollection type.

Observations & Measurements standard

Within the ObservationCollection should be 1 or more Observation or Measurement types. The minimum number of observations that is required by INTAMAP is 20, any fewer and an exception will be raised.

The O&M specification defines several properties of an Observation - most of which we ignore. Below lists the properties that we don't ignore and what they should contain.

  • featureOfInterest - This is essentially the location of the Observation. In here can be any 'feature' type (according to the GML schema). However, the O&M specification has kindly provided a set of features that are capable of describing the location of observations. These are located in the sampling schema (view more info). Within INTAMAP we look for the SamplingPoint feature that contains a GML Point.
  • resultQuality - This is where you put any uncertainty about the Observation. This can be any XML type, which doesn't really narrow it down. For the purpose of the INTAMAP service we only accept the UncertML Distribution type as a measure of uncertainty.
  • procedure - This is where you specify the sensor model information. Currently this accepts the MathML apply type.
  • result - This is the observed value. According to the O&M specification it can be any XML type, this is too broad for our purposes, so we have narrowed it down to just a single real value. The Measurement type is restricted to a single real value by the schema and so is more suited to our needs.
  • srsName - This specifies the Spatial Reference System (SRS) of either an individual Observation or an entire ObservationCollection. If an ObservationCollection contains an srsName property then we will assume all observations are of the same SRS. If, however, the ObservationCollection does not contain an srsName property but the individual observations do then we will use those only if they are all the same. The srsName should contain either just an EPSG code (e.g. 4326 for lng/lat) or an OGC URN of the following format: urn:ogc:def:crs:EPSG:<EPSG CODE>. An Observation may specify it's SRS inside the featureOfInterest property too.

An example observation can be seen here - O&M Observation.

Domain

The domain is a fancy name for 'prediction locations'. We utilise the GML geometry types for this parameter, the list below defines the types we accept:

  • Point
  • Polygon
  • MultiPoint
  • MultiPolygon
  • RectifiedGrid

This parameter is optional - if you don't specify the prediction locations we will create a rectified grid around your supplied observations with 10,000 points.

A domain can contain an srsName attribute similar to that described above. If the ObservationCollection and domain have different SRSs then we will project the observations before interpolation.

PredictionType

This parameter allows you to specify what it is you want from us. This is encoded using a variety of UncertML types. Below is a list of currently accepted types.

  • Mean
  • Variance
  • Probability (of exceeding a specified value)
  • Quantile

These are encoded using the UncertML Statistic type.

If you do not supply a PredictionType then we will assume you want the mean and variance.

Note that in the case of Inverse Distance Weight (IDW method name), it is necessary to indicate UncerML type mean, because the default mean and variance request will generate an error since IDW doesn't support variance calculation.

MethodName

This parameter accepts a string, it is the name of the interpolation method you wish to use. Below is a list of known interpolation methods.

  • automap
  • copula
  • psgp
  • idw
  • automatic

If you do not specify a method name then we will try to calculate the best algorithm for your purpose. If you specify an incorrect method name, you'll get an exception!

SOSURL

This parameter can be used either alone or in conjunction with the SOSRequest parameter (see below).

It contains a string which is a URL pointing to a Sensor Observation Service instance. If this URL is a GET request then it may be used alone, however, if you wish to send a POST request to the SOS then this is achieved using the parameter below.

If you specify a URL and a valid request we will send it to the SOS and parse the returned observations and use them in the interpolation. You can either use the SOS on its own, or combine the SOS observations with other observations described in the ObservationCollection parameter.

Warning we can only accept SOS requests that return om:Measurement types - you can request this using the resultModel parameter of a SOS GetObservations request. It is also your responsibility to ensure the SOS returns sensible results, i.e. no duplicated locations, no outliers etc.

SOSRequest

This parameter can only be used in conjunction with the SOSURL parameter described above. This parameter contains an XML fragment that validates against the SOS GetObservations schema. We will take this request and send it to the URL specified in the SOSURL parameter. Upon receiving the result from the SOS we will parse the observations and merge them with any observations specified in the ObservationCollection parameter (if any).

MethodParameters

This parameter is used to pass parameters directly to the methods in R. It takes the form of KVP. Below is an example XML fragment:

<int:MethodParameters xmlns:int="http://www.intamap.org">
   <int:parameters>
      <int:Parameter>
         <int:name>Nugget</int:name>
         <int:value>34.21</int:value>
      </int:Parameter>
      <int:Parameter>
         <int:name>CovarianceFunction</int:name>
         <int:value>Matern</int:value>
      </int:Parameter>
   </int:parameters>
</int:MethodParameters>

The individual R methods should list which parameters they support below

automap

  • parameter_name : expected_values

copula

  • parameter_name : expected_values

psgp

  • parameter_name : expected_values

OutlierDetection

This parameter is a boolean that specifies whether you want to perform outlier detection on the observations. If this is set to true we will send all observations (including SOS output) to another Web Processing Service that will perform simple outlier detection (DAN -- can you write what it does here please!).

The interpolation will then only use the observations that are not deemed to be outliers. Below is a snippet that requests that OutlierDetection be performed. The default is false.

<wps:Input>
   <ows:Identifier>OutlierDetection</ows:Identifier>
   <wps:Data>
      <wps:LiteralData dataType="xs:boolean">true</wps:LiteralData>
   </wps:Data>
</wps:Input>

maximumTime

This parameter is a simple integer value (currently a string) that specifies the maximum time you're willing to wait - in seconds.

Using this information we can either choose a suitable method for your interpolation or return an exception stating it is not possible.

Below is a snippet that specifies you are willing to wait 100 seconds.

<wps:Input>
   <ows:Identifier>maximumTime</ows:Identifier>
   <wps:Data>
      <wps:LiteralData dataType="xs:string">100</wps:LiteralData>
   </wps:Data>
</wps:Input>

Outputs

There are a number of outputs you can request from the WPS. this section explains what they are.

PredictedValues

This is the actual result of the interpolation - you don't have to receive this as an output, but then what is the point?? The result of this is an UncertML StatisticsArray type containing comma separated values of the statistics you requested as an input.

Domain

Sometimes you don't specify the domain (or prediction locations) as an input. In this case we generate a rectified grid for you. However, if we have generated the grid for you, how do you know where each prediction location is? By asking for the domain to be returned as an output you can figure it out.

PredictionReport

This is a report detailing everything that happened to your data. It is a structured string.

MethodParameters

This output is used to return an R string that contains the exact parameters that were used in your interpolation. The intended use is that you can then pass this string back in to the WPS on subsequent interpolations to ensure the identical parameters will be used. The string will look something like this:

\n vvmod =  vgm(16.2655700411874,\"Ste\",1265.48940344574,anis =c(25.1113527463443,0.531507461849014) ,add.to =  vgm(0.705683839910609,
\"Nug\",0,anis =c(0,1) ) ) \n vvmod$kappa =  c( 0,0.3 ) \n \n object$variogramModel = vvmod \n QQ =  matrix(c( 9.50897044633664e-
05,4.49600704975795e-05,-3.01079810092796e-05 ),ncol=3) \n colnames(QQ) = list(\"Q11\",\"Q22\",\"Q12\") \n anisPar = list(ratio =
1.88144113070622 , direction =  64.8886472536557 , Q= QQ,doRotation =  TRUE )\n object$anisPar = anisPar \nclass(object) = \"automap\"\n

You can then pass this back in to the WPS using the MethodParameters input with a parameter called methodParameters. Below is a snippet to show you how to do this:

<wps:Input>
   <ows:Identifier>MethodParameters</ows:Identifier>
   <wps:Data>
      <wps:ComplexData>
         <int:MethodParameters  xmlns:int="http://www.intamap.org">
            <int:parameters>
               <int:Parameter>
                  <int:name>methodParameters</int:name>
                  <int:value>
                     \n vvmod =  vgm(16.2655700411874,\"Ste\",1265.48940344574,anis =c(25.1113527463443,0.531507461849014)
                     ,add.to =  vgm(0.705683839910609,\"Nug\",0,anis =c(0,1) ) ) \n vvmod$kappa =  c( 0,0.3 ) \n \n object$
                     variogramModel = vvmod \n QQ =  matrix(c( 9.50897044633664e-05,4.49600704975795e-05,-3.01079810092796e-05 )
                     ,ncol=3) \n colnames(QQ) = list(\"Q11\",\"Q22\",\"Q12\") \n anisPar = list(ratio =  1.88144113070622 , 
                     direction =  64.8886472536557 , Q= QQ,doRotation =  TRUE )\n object$anisPar = anisPar \nclass(object) = 
                     \"automap\"\n
                  </int:value>
               </int:Parameter>
            </int:parameters>
         </int:MethodParameters>
      </wps:ComplexData>
   </wps:Data>
</wps:Input>


Warning I have put in new lines in these examples for formatting reasons - these will not work if you cut and paste them in a request. The methodParameters parameter must be exactly as is returned from the MethodParameters output.

Examples

Lots of example requests and responses can be found on our SVN:

Read through some example requests