Hi Matthias,
Try this mapping :
<AttributeMapping>
<targetAttribute>gml:validTime</targetAttribute>
<targetAttributeNode>gml:TimeInstantPropertyType</targetAttributeNode>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gml:validTime/gml:TimeInstant/gml:timePosition</targetAttribute>
<sourceExpression>
<OCQL>validtime_beginposition</OCQL>
</sourceExpression>
</AttributeMapping>
Extract from
http://docs.geoserver.org/trunk/en/user/data/app-schema/mapping-file.html:
targetAttributeNode is required wherever a property type contains an abstract
element and app-schema cannot determine the type of the enclosed attribute.
This mapping must come before the mapping for the enclosed elements.
Regards,
Florence
-----Original Message-----
From: Matthias Pohl [mailto:[email protected]]
Sent: Thursday, 2 September 2010 5:58 PM
To: [email protected]
Subject: Re: [Geoserver-users] gml:TimePeriod, app-schema and PostgreSQL
Hello,
this is some additional information about the issue: The PostgreSQL
database contains a column
validtime_beginposition TIMESTAMP NOT NULL
which is mapped via the app-schema plugin as follows:
<AttributeMapping>
<targetAttribute>gml:validTime</targetAttribute>
<sourceExpression>
<OCQL>validtime_beginposition</OCQL>
</sourceExpression>
</AttributeMapping>
Note that gml:validTime may be one of gml:TimePeriod or gml:TimeInstant
as defined by the GML-3.1.1 schema. Thus, in a feature whose
"validtime_beginposition" is "2010-08-22 22:00:00", we would have
expected one of the following outputs:
1)
<gml:validTime>
<gml:TimeInstant gml:id="...">
<gml:timePosition>2010-08-22 22:00:00</gml:beginPosition>
</gml:TimeInstant>
</gml:validTime>
2)
<gml:validTime>
<gml:TimePeriod gml:id="...">
<gml:beginPosition>2010-08-22 22:00:00</gml:beginPosition>
<gml:endPosition/>
</gml:TimePeriod>
</gml:validTime>
3)
<gml:validTime>
<gml:TimePeriod gml:id="...">
<gml:beginPosition>2010-08-22 22:00:00</gml:beginPosition>
<gml:endPosition>2010-08-22 22:00:00</gml:endPosition>
</gml:TimePeriod>
</gml:validTime>
However, GeoServer instead returns an empty element. There are no
error messages in the (verbose) log:
<gml:validTime/>
In addition, we have another column
validtime_endposition TIMESTAMP NOT NULL
which should provide the second part of the gml:validTime, but there
seems to be no way in CQL to formulate the mapping. We hoped that at
least one the following ways was possible:
A)
validtime_beginposition TIMESTAMP NOT NULL,
validtime_endposition TIMESTAMP NOT NULL,
<AttributeMapping>
<targetAttribute>gml:validTime</targetAttribute>
<sourceExpression>
<OCQL>
makeTimePeriod(validtime_beginposition, validtime_endposition)
</OCQL>
</sourceExpression>
</AttributeMapping>
B)
validtime TIMEPERIOD NOT NULL,
<AttributeMapping>
<targetAttribute>gml:validTime</targetAttribute>
<sourceExpression><OCQL>validtime</OCQL></sourceExpression>
</AttributeMapping>
C)
validtime_beginposition TIMESTAMP NOT NULL,
validtime_endposition TIMESTAMP NOT NULL,
<AttributeMapping>
<targetAttribute>
gml:validTime/gml:TimePeriod/gml:beginPosition
</targetAttribute>
<sourceExpression>
<OCQL>validtime_beginposition</OCQL>
</sourceExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>
gml:validTime/gml:TimePeriod/gml:endPosition
</targetAttribute>
<sourceExpression>
<OCQL>validtime_endposition</OCQL>
</sourceExpression>
</AttributeMapping>
However, neither of these appears to be working.
A fails because there is no "makeTimePeriod()" or similar function.
B fails because it is no such column type "TIMEPERIOD" in PostgreSQL.
C fails because sub mappings within a gml:TimePeriod are not supported:
java.lang.IllegalArgumentException:
gml:TimePeriod is not a valid location path for type
http://www.opengis.net/gml:TimePrimitivePropertyType. gml:TimePeriod ns:
http://www.opengis.net/gml, TimePrimitivePropertyType properties:
http://www.opengis.net/gml#_TimePrimitive,
http://www.w3.org/1999/xlink#actuate,
http://www.w3.org/1999/xlink#arcrole, http://www.w3.org/1999/xlink#href,
http://www.opengis.net/gml#remoteSchema,
http://www.w3.org/1999/xlink#role, http://www.w3.org/1999/xlink#show,
http://www.w3.org/1999/xlink#title, http://www.w3.org/1999/xlink#type
Is there any possibility to solve that issue?
matt
> we're trying to provide gml:TimePeriod elements in a WFS reply.
>
> The mapping rules for the app-schema plugin are quite clear, but
> what column type is required in the PostgreSQL database?
>
> There is no native "TimePeriod" type in PostgreSQL, so the
> time range is currently stored in two TIMESTAMP columns. Is
> it possible to map those two columns onto one attribute of
> type gml:TimePeriod? Or is a special custom data type needed
> in PostgreSQL?
>
> How are properties of type gml:TimePeriod meant to be used
> with GeoServer and PostgreSQL?
>
> This is the expected output:
>
> <gml:validTime>
> <gml:TimePeriod gml:id="id_1">
> <gml:beginPosition>2010-09-07T10:00:00.0</gml:beginPosition>
> <gml:endPosition>2010-09-07T13:00:00.0</gml:endPosition>
> </gml:TimePeriod>
> </gml:validTime>
>
> Best regards,
>
> matt
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users