Overview

The WaterqualityApp import function (<importType>WaterqualityApp</importType>) imports from the waterquality REST service.

Configuring the Import

To make the importer known to FEWS, the import module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://www.wldelft.nl/fews
		http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0">
...
	
    <moduleInstanceDescriptor id="ImportWaterquality">
		<moduleId>TimeSeriesImportRun</moduleId>
	</moduleInstanceDescriptor>


...
</moduleInstanceDescriptors>

An example of the WaterqualityApp import configuration will be given here. The importType is named WaterqualityApp which should be configured in the general section of the import. De URL to the rest service should be configured here as well. To map measurements to a location, a maximumSnapDistance should be used. In this example for location Twente all locations that are within 20km of the lat lon defined for Twente, will be mapped to location Twente. The location configuration could be as follows:

     <location id="Twente" name="Twente">
		<x>6.886368</x>
		<y>52.207186</y>
		<z>0</z>
	</location>

To be able to track the location for each value that is measured, two extra parameters will be used to store the longitude and latitude information of the measurement. They can be defined in the Parameters.xml as follows:

		<parameterGroup id="Tracks">
			<parameterType>instantaneous</parameterType>
			<unit>-</unit>
			<valueResolution>0.0001</valueResolution>
			<parameter id="X" name="Xcoord">
				<shortName>X-coord</shortName>
			</parameter>
			<parameter id="Y" name="Ycoord">
				<shortName>Y-coord</shortName>
			</parameter>
		</parameterGroup>

To import the nitrate values and the track information, 3 timeSeriesSets need to be imported.The actual import configuration is given here:

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://www.wldelft.nl/fews 
	http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd">
	<import>
		<general>
			<importType>WaterqualityApp</importType>
			<serverUrl>http:/servernam/waterkwaliteit-app-service/v1/waterkwaliteitmetingen/</serverUrl>
			<relativeViewPeriod unit="hour" start="-1" end="0" startOverrulable="true" endOverrulable="false"/>
			<maximumSnapDistance>20000</maximumSnapDistance>
			<missingValue>-9999</missingValue>
		</general>
		<timeSeriesSet>
			<moduleInstanceId>ImportWaterquality</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>nitraat</parameterId>
			<locationId>Twente</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
		<timeSeriesSet>
			<moduleInstanceId>ImportWaterkwaliteit</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>X</parameterId>
			<locationId>Twente</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
		<timeSeriesSet>
			<moduleInstanceId>ImportWaterkwaliteit</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Y</parameterId>
			<locationId>Twente</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
	</import>

</timeSeriesImportRun>

Example JSON file:

[{id: 165,

parameter: "nitraat",

timestamp: 1455873768599,

value: 4.4,

latitude: 0,

longitude: 0,

description: "",

category: "Grondwater"

},

{id: 166,

parameter: "nitraat",

timestamp: 1455878245278,

value: 7,

latitude: 0,

longitude: 0,

description: "",

category: "Grondwater"
}
]

  • No labels