DAC installation guide (final).doc

Introduction

The WaterML2 service is hosted in a Tomcat service container. This service allows REST clients to interact with a WaterML2  service that is connected to a FEWS system through the FEWS DataAccessComponent. With this API the REST client can retrieve data from the FEWS system. Before a client application can access the FEWS system there is some configuration work that needs to be done.

WaterML2 Service API

Get Capabilities request

http://localhost:8081/WaterMlService/waterml?request=GetCapabilities

The GetCapabilities request returns a document describing the operations supported by this webservice.

Get Capabilities response

<?xml version="1.0" encoding="UTF-8"?>
<sos:Capabilities xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:oost="http://www.oostethys.org/schemas/0.1.0/oostethys" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:ogc="http://www.opengis.net/ogc" xsi:schemaLocation="http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/2.0.0/sosGetCapabilities.xsd" version="2.0.0">
    <ows:ServiceIdentification>
        <ows:Title></ows:Title>
        <ows:ServiceType>OGC:SOS</ows:ServiceType>
        <ows:ServiceTypeVersion>2.0.0</ows:ServiceTypeVersion>
        <ows:Fees>None</ows:Fees>
        <ows:AccessConstraints>None</ows:AccessConstraints>
    </ows:ServiceIdentification>
    <ows:ServiceProvider>
        <ows:ProviderName></ows:ProviderName>
        <ows:ProviderSite xlink:href=""/>
        <ows:ServiceContact>
            <ows:IndividualName></ows:IndividualName>
            <ContactInfo>
                <ows:Address>
                    <ows:DeliveryPoint></ows:DeliveryPoint>
                    <ows:City></ows:City>
                    <ows:PostalCode></ows:PostalCode>
                    <ows:Country></ows:Country>
                    <ows:ElectronicMailAddress></ows:ElectronicMailAddress>
                </ows:Address>
            </ContactInfo>
        </ows:ServiceContact>
    </ows:ServiceProvider>
    <ows:OperationsMetadata>
        <ows:Operation name="GetCapabilities">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://localhost:8081/WaterMlService/waterml?request=GetCapabilities"/>
                </ows:HTTP>
            </ows:DCP>
            <ows:Parameter name="service">
                <ows:AllowedValues>
                    <ows:Value>SOS</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="version">
                <ows:AllowedValues>
                    <ows:Value>1.0.0</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
        </ows:Operation>
        <ows:Operation name="GetFeature">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://localhost:8081/WaterMlService/waterml?request=GetFeature"/>
                </ows:HTTP>
            </ows:DCP>
            <ows:Parameter name="service">
                <ows:AllowedValues>
                    <ows:Value>SOS</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="version">
                <ows:AllowedValues>
                    <ows:Value>1.0.0</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
        </ows:Operation>
        <ows:Operation name="GetObservation">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://localhost:8081/WaterMlService/waterml?request=GetObservation"/>
                    <ows:Post xlink:href="http://localhost:8081/WaterMlService/waterml?request=GetObservation"/>
                </ows:HTTP>
            </ows:DCP>
            <ows:Parameter name="service">
                <ows:AllowedValues>
                    <ows:Value>SOS</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="version">
                <ows:AllowedValues>
                    <ows:Value>1.0.0</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="request">
                <ows:AllowedValues>
                    <ows:Value>GetObservation</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="featureId">
                <ows:AllowedValues>
                    <ows:Value>0</ows:Value>
                    <ows:Value>1</ows:Value>
                    <ows:Value>2</ows:Value>
                    <ows:Value>3</ows:Value>
                    <ows:Value>4</ows:Value>
                    <ows:Value>5</ows:Value>
                    <ows:Value>6</ows:Value>
                    <ows:Value>7</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="observedProperty">
                <ows:AllowedValues>
                    <ows:Value>Parameter</ows:Value>
                    <ows:Value>T.for</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="beginPosition">
                <ows:AllowedValues>
                    <ows:AnyValue/>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="endPosition">
                <ows:AllowedValues>
                    <ows:AnyValue/>
                </ows:AllowedValues>
            </ows:Parameter>
            <ows:Parameter name="analysisTime">
                <ows:AllowedValues>
                    <ows:AnyValue/>
                </ows:AllowedValues>
            </ows:Parameter>
        </ows:Operation>
    </ows:OperationsMetadata>
</sos:Capabilities>

Get Feature request

http://localhost:8081/WaterMlService/waterml?request=GetFeature

The GetFeature request returns a document containing a list of feature members supported by the webservice. A feature member corresponds to what is know in FEWS as Location.

Get Feature response

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gsml="urn:cgi:xmlns:CGI:GeoSciML:2.0" xmlns:om="http://www.opengis.net/om/2.0" xmlns:sa="http://www.opengis.net/sampling/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wml2="http://www.opengis.net/waterml/2.0" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:sf="http://www.opengis.net/sampling/2.0" xmlns:sams="http://www.opengis.net/samplingSpatial/2.0" xsi:schemaLocation="http://www.opengis.net/om/2.0 ../observation.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd http://www.opengis.net/sampling/2.0 ../samplingFeature.xsd http://www.opengis.net/waterml/2.0 ../waterml2.xsd http://www.opengis.net/swe/2.0 http://schemas.opengis.net/sweCommon/2.0/swe.xsd">
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="0">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>0</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="0">
                        <gml:pos srcName="Rijks Driehoekstelsel">53.64671168116518 5.175518773508316</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="1">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>1</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="1">
                        <gml:pos srcName="Rijks Driehoekstelsel">53.3835058954904 4.560651062185197</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="2">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>2</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="2">
                        <gml:pos srcName="Rijks Driehoekstelsel">52.48257667744973 4.283120419290973</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="3">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>3</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="3">
                        <gml:pos srcName="Rijks Driehoekstelsel">51.493692036021535 3.0541898956873954</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="4">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>4</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="4">
                        <gml:pos srcName="Rijks Driehoekstelsel">50.99065599128154 3.0796721627765615</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="5">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>5</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="5">
                        <gml:pos srcName="Rijks Driehoekstelsel">51.01107956492021 4.6177610376887515</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="6">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>6</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="6">
                        <gml:pos srcName="Rijks Driehoekstelsel">50.59113044096123 5.4719202115344</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
    <wfs:member>
        <om:featureOfInterest>
            <wml2:WaterMonitoringPoint gml:id="7">
                <sf:parameter>
                    <om:NamedValue>
                        <om:name xlink:title="Location name"/>
                        <om:value>7</om:value>
                    </om:NamedValue>
                </sf:parameter>
                <sams:shape>
                    <gml:Point gml:id="7">
                        <gml:pos srcName="Rijks Driehoekstelsel">50.58761564487022 6.290845285636415</gml:pos>
                    </gml:Point>
                </sams:shape>
            </wml2:WaterMonitoringPoint>
        </om:featureOfInterest>
    </wfs:member>
</wfs:FeatureCollection>

Get Observations Request

The GetObservations call supports two types of requests:

  1. Firstly the HTTP-GET request where all request parameters are entered in the URL string.

The HTTP-GET option supports the following URL parameters

http://localhost:8081/WaterMlService/waterml?request=GetObservation&featureId=1&observedProperty=Parameter&beginPosition=2013-02-01T00:00:00%2B01:00&endPosition=2013-03-01T00:00:00%2B01:00&analysisTime=2013-02-01T00:00:00%2B01:00

The HTTP-POST option is passed as a XML document containing the following elements:

<?xml version="1.0" ?>
<sos:GetObservation version="2.0.0" service="SOS"
    maxFeatures="3"
    xmlns:sos="http://schemas.opengis.net/sos/2.0.0/"
    xmlns:wfs="http://www.opengis.net/wfs"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:gml="http://www.opengis.net/gml/3.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:om="http://www.opengis.net/om/2.0"
    xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0.0/sos.xsd">
    <sos:featureOfInterest>0</sos:featureOfInterest>
    <sos:observedProperty>T.for</sos:observedProperty>
    <sos:temporalFilter>
        <fes:During>
            <fes:ValueReference>phenomenonTime</fes:ValueReference>
            <gml:TimePeriod gml:id="tp_1">
                <gml:beginPosition>2013-02-15T01:00:00.000+01:00</gml:beginPosition>
                <gml:endPosition>2013-03-01T01:00:00.000+01:00</gml:endPosition>
            </gml:TimePeriod>
        </fes:During>
    </sos:temporalFilter>
    <sos:temporalFilter>
        <fes:TEquals>
            <fes:ValueReference>analysisTime</fes:ValueReference>
            <gml:TimeInstant gml:id="ti_2">
                <gml:timePosition>2013-03-02T00:00:00.000+01:00</gml:timePosition>
            </gml:TimeInstant>
        </fes:TEquals>
    </sos:temporalFilter>
</sos:GetObservation>
                        

Get Observations Response

 

<wml2:Collection xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wml2="http://www.opengis.net/waterml/2.0" xmlns:om="http://www.opengis.net/om/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sf="http://www.opengis.net/sampling/2.0" xmlns:sams="http://www.opengis.net/samplingSpatial/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/waterml/2.0 ../waterml2.xsd">
    <gml:description>0</gml:description>
    <wml2:metadata>
        <wml2:DocumentMetadata gml:id="WaterMlServletResponse_WaterMlServlet">
            <wml2:generationDate>2015-03-16T17:40:35+01:00</wml2:generationDate>
        </wml2:DocumentMetadata>
    </wml2:metadata>
    <wml2:observationMember>
        <om:OM_Observation gml:id="timeseries_0">
            <om:phenomenonTime>
                <gml:TimePeriod gml:id="series_period">
                    <gml:beginPosition>2013-02-20T00:00:00+01:00</gml:beginPosition>
                    <gml:endPosition>2013-03-01T01:00:00+01:00</gml:endPosition>
                </gml:TimePeriod>
            </om:phenomenonTime>
            <om:resultTime>
                <gml:TimeInstant gml:id="series_available">
                    <gml:timePosition>2015-03-16T17:40:35+01:00</gml:timePosition>
                </gml:TimeInstant>
            </om:resultTime>
            <om:parameter>
                <om:NamedValue>
                    <om:name xlink:title="T0 (Time of analysis)" xlink:role="analysisTime"/>
                    <om:value xsi:type="gml:TimePositionType">2013-03-02T00:00:00+01:00</om:value>
                </om:NamedValue>
            </om:parameter>
            <om:observedProperty xlink:href="http://nl.wldelft.waterml/parameters/T.for" xlink:title="Temperature forecast"/>
            <om:featureOfInterest>
                <wml2:MonitoringPoint gml:id="0">
                    <sf:parameter>
                        <om:NamedValue>
                            <om:name xlink:title="Location name"/>
                            <om:value>0</om:value>
                        </om:NamedValue>
                    </sf:parameter>
                    <sams:shape>
                        <gml:Point gml:id="0">
                            <gml:pos srcName="Rijks Driehoekstelsel">141000.0 629000.0</gml:pos>
                        </gml:Point>
                    </sams:shape>
                    <wml2:timeZone>
                        <wml2:TimeZone>
                            <wml2:zoneOffset>+1</wml2:zoneOffset>
                            <wml2:zoneAbbreviation>GMT</wml2:zoneAbbreviation>
                        </wml2:TimeZone>
                    </wml2:timeZone>
                </wml2:MonitoringPoint>
            </om:featureOfInterest>
            <om:result>
                <wml2:MeasurementTimeseries gml:id="timeseries_0">
                    <wml2:temporalExtent>
                        <gml:TimePeriod gml:id="timeseries_period_0">
                            <gml:beginPosition>2013-02-20T00:00:00+01:00</gml:beginPosition>
                            <gml:endPosition>2013-03-01T01:00:00+01:00</gml:endPosition>
                        </gml:TimePeriod>
                    </wml2:temporalExtent>
                    <wml2:defaultPointMetadata>
                        <wml2:DefaultTVPMeasurementMetadata>
                            <wml2:uom uom="C"/>
                            <wml2:interpolationType xlink:href="http://www.opengis.net/def/waterml/2.0/interpolationType/Discontinuous" xlink:title="Discontinuous"/>
                        </wml2:DefaultTVPMeasurementMetadata>
                    </wml2:defaultPointMetadata>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2013-02-20T00:00:00+01:00</wml2:time>
                            <wml2:value>0.37933815</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>

        <!--    ... skipped some values -->

                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2013-02-28T22:59:59+01:00</wml2:time>
                            <wml2:value>-0.38247958</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2013-03-01T00:00:00+01:00</wml2:time>
                            <wml2:value>-0.23891993</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2013-03-01T01:00:00+01:00</wml2:time>
                            <wml2:value>0.086797565</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                </wml2:MeasurementTimeseries>
            </om:result>
        </om:OM_Observation>
    </wml2:observationMember>
</wml2:Collection>

Installing a WaterML2 Service

The file DAC installation guide (final).doc describes how to install a Tomcat instance containing a DataAccessComponent instance. Once these steps are completed the WaterMlService.WAR can be deployed using a context xml file such as WaterMLService.xml

Configuration

The are two levels of configuration. The first is the DataAccessComponent which is a FEWS client hosted as a GlobalResource in Tomcat. The DataAccessComponent uses the regular FEWS configuration which falls outside the scope of this documentation. The second level of configuration is what is used by the FewsPiService webservice which has been deployed in Tomcat. To deploy this webservice a context XML file is required which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!-- Location of specific AI war file. (Can be a symlink) -->
<Context docBase="${catalina.home}/fews/WaterMlService.war" antiJARLocking="true" crossContext="true" >
    <!—- 'clientConfigFileId' points to a FEWS configuration file in de FEWS configuration directory 'PiClientConfigFiles'. -->
     <Parameter name="clientConfigFileId" value="WaterMlService.properties" override="false"/>
    <!—- resourceId must match the 'name' of 'ResourceLink' below -->
     <Parameter name="resourceId" value="DAC" override="false"/>
    <!—-  Global 'fews_dac' must be the same as the DAC resource name in the file 'server.xml'-->
     <ResourceLink name="DAC"
                  global="fews_dac"
                  type="nl.wldelft.fews.system.data.dac.DataAccessComponent"/>
     <Loader loaderClass="nl.wldelft.fews.system.data.dac.DacClassLoader" delegate="true"/>
</Context>

In the above configuration example you see two 'Parameter' values which will be explained below:

FEWS Client Config File (clientConfigFileId)

This is a simple text configuration file that is located in the FEWS configuration in the directory:

%REGION_HOME%/Config/PiClientConfigFiles/WaterMlService.properties

In the above example the clientConfigFileId would be WaterMlService.properties.

This properties file can contain the following configuration items:

\# This file must be placed in the FEWS configuration folder Config/PiClientConfigFiles.
\# It is referenced by the FewsPiService webservice through the parameter 'clientConfigFileId' in the service context.xml file.
\# Note that all id references are case sensitive.

\# This element defines the root filter id for the webservice (type = string).
\# If omitted the FewsPiService will try to retrieve the defaultFilterId from the Filters.xml.
FILTER_ID=My_FilterId

\# Identifier of the flag conversion file to use when extracting timeseries from the FewsPiService (type = string).
\# If omitted no flag conversion takes place
EXPORT_FLAGCONVERSION_ID=My_Export_FlagConversion

\# Identifier of the unit conversion file to use when extracting timeseries from the FewsPiService (type = string).
\# If omitted no unit conversion takes place
EXPORT_UNITCONVERSION_ID=My_Export_UnitConversion

\# Identifier of the id map file to use when extracting timeseries from the FewsPiService (type = string).
\# If omitted no id mapping takes place
\#EXPORT_IDMAP_ID=My_Export_IdMap

\# Identifier of the unit conversion file to use when writing timeseries to the FewsPiService (type = string).
\# If omitted no unit conversion takes place
IMPORT_UNITCONVERSION_ID=My_Import_UnitConversion

\# Identifier of the id map file to use when writing timeseries to the FewsPiService (type = string).
\# If omitted no id mapping takes place
IMPORT_IDMAP_ID=My_Import_IdMap

\# Export missing value. All internal NaN values will be mapped to this value (type = float).
\# If omitted the default value \-999 will be used.
MISSING_VALUE=-999

\# Option to skip the export of missing values when reading timeseries from the FewsPiService (type = true/false).
\# If omitted the default value 'true' is used.
OMIT_MISSING_VALUES=true

\# Default time zone.
\# If omitted the computer time zone is used.
TIME_ZONE=GMT

Here follows a explanation of these parameters. By the way everything is case sensitive: