Hi all,
I have a table containing point time observations for several parameters:
TIME PARAMETER_1 PARAMETER_2 PARAMETER_3 TIME_SERIES_ID
2015-10-26 01:00:00+01 9.70 326 1.30 1
2015-10-26 02:00:00+01 8.90 348 0.90 1
2015-10-26 03:00:00+01 8.40 345 2.30 1
2015-10-26 04:00:00+01 8.00 192 0.50 1
I would like to map these values to a swe:DataArray element, nested in a OM_Observation feature:
om:OM_Observation
om:phenomenonTime
gml:TimePeriod
gml:beginPosition2015-10-26T01:00:00+01:00</gml:beginPosition>
gml:endPosition2015-10-26T04:00:00+01:00</gml:endPosition>
</gml:TimePeriod>
</om:phenomenonTime>
om:resultTime
gml:TimeInstant
gml:timePosition2015-10-26T04:00:00+01:00</gml:timePosition>
</gml:TimeInstant>
</om:resultTime>
…
om:result
swe:DataArray
swe:elementCount
swe:Count
swe:value4</swe:value>
</swe:Count>
</swe:elementCount>
<swe:elementType name=“Components”>
swe:DataRecord
<swe:field name=“Time”>
<swe:Time definition=“http://www.opengis.net/def/property/OGC/0/SamplingTime”>
<swe:uom xlink:href=“http://www.opengis.net/def/uom/ISO-8601/0/Gregorian” />
</swe:Time>
</swe:field>
<swe:field name=“PARAMETER_1”>
swe:Quantity
swe:labelPARAMETER_1</swe:label>
<swe:uom code=“Cel” xlink:href=“http://codes.wmo.int/common/unit/Cel” />
</swe:Quantity>
</swe:field>
<swe:field name=“PARAMETER_2”>
swe:Quantity
swe:labelPARAMETER_2</swe:label>
<swe:uom code=“deg” xlink:href=“http://codes.wmo.int/common/unit/degree_(angle)” />
</swe:Quantity>
</swe:field>
<swe:field name=“PARAMETER_3”>
swe:Quantity
swe:labelPARAMETER_3</swe:label>
<swe:uom code=“m/s” xlink:href=“http://codes.wmo.int/common/unit/m_s-1” />
</swe:Quantity>
</swe:field>
</swe:DataRecord>
</swe:elementType>
swe:encoding
<swe:TextEncoding blockSeparator=“@@” decimalSeparator=“.” tokenSeparator=“,” />
</swe:encoding>
swe:values2015-10-26T01:00:00+01:00,9.70,326,1.30@@
2015-10-26T02:00:00+01:00,8.90,348,0.90@@
2015-10-26T03:00:00+01:00,8.40,345,2.30@@
2015-10-26T04:00:00+01:00,8.00,192,0.50
</swe:values>
</swe:DataArray>
</om:result>
</om:OM_Observation>
To achieve this, I created a view in the database where I aggregate the records by TIME_SERIES_ID, calculate min(TIME) and max(TIME), to be mapped to beginPosition and endPosition/resultTime respectively, and text encode the array values as shown above.
I have two questions:
-
Would it be possible to achieve the same result without creating a view? I guess for the array values, I could concatenate fields using the strConcat CQL function and blocks leveraging the isList mapping directive (blocks would have to be separated by a blank space)… but how could I calculate min and max values for the TIME column? To my knowledge, there is no CQL equivalent to SQL’s MIN() and MAX() aggregation functions, so I would have to add two columns to the table (e.g., BEGIN_POS and END_POS), pre-calculate the min and max time values for each time series and store them there… which sounds worse than the view-based approach. Any better ideas?
-
I would like to be able to filter the values that end up in the DataArray via a WFS query, e.g. I would like to specify a time frame: is this possible at all? I don’t seem to be able to come up with a mapping strategy / XPath filter to achieve this…
Any hint is highly appreciated.
···
Best regards,
Stefano Costa
==
GeoServer Professional Services from the experts! Visit
[http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==
Dott. Stefano Costa
Senior Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_it](http://twitter.com/geosolutions_it)
-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate.
Il loro utilizzo è consentito esclusivamente al destinatario del
messaggio, per le finalità indicate nel messaggio stesso. Qualora
riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
Data Protection Code).Any use not in accord with its purpose, any
disclosure, reproduction, copying, distribution, or either
dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the
intended recipient, please contact immediately the sender by
telephone, fax or e-mail and delete the information in this message
that has been received in error. The sender does not give any warranty
or accept liability as the content, accuracy or completeness of sent
messages and accepts no responsibility for changes made after they
were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.