I am trying to get the time templates to work with some date/time data stored
in PostGIS. The column appears as expected in WFS (see end of message), but
it seems that the KML time template is truncating the seconds off the data.
(GeoServer Version: 1.5.3)
The column I am working with is called rpt_year_timestamp, and it is a
PostgreSQL "timestamp without timezone" data type. A query of the table
(leaving out the geometry column) looks like
"gid","name","rpt_year_timestamp"
100,"Monaco","2002-04-04 04:40:45"
98,"Monaco","2000-04-02 02:20:25"
99,"Monaco","2001-04-03 03:30:35"
When I specify the following time template:
${rpt_year_timestamp.value?datetime("MM/dd/yy hh:mm:ss a")}
I get a KML time tag that is lacking the seconds:
<TimeStamp><when>2002-04-04T04:40:00Z</when>
Any ideas on how to get the seconds to appear in the KML?
- Tyler
Additional Info...
If I intentionally force an error in the time template, I get the following
error message that seems to indicate the date that freemarker is working
with (4/3/01 3:30 AM) is missing the seconds.
GetMap Request
version: 1.1.1
output format: application/vnd.google-earth.kmz XML
width height: 1024,1024
bbox: Env[7.262427222830156 : 7.582127764492826, 43.66652897922899 :
43.85631395065467]
layers: postgis:t_inet_weu
styles: inet_weu_postgis
03 Sep 16:07:19 ERROR [freemarker.runtime] -
Error: on line 1, column 3 in time.ftl
Expecting a date here, found: 4/4/02 4:40 AM
The problematic instruction:
----------
==> ${rpt_year_timestamp.value?datetime("MM/dd/yy hh:mm:ss a")} [on line 1,
column 1 in time.ftl]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Error: on line 1, column 3 in
time.ftl
Expecting a date here, found: 4/4/02 4:40 AM
at freemarker.core.BuiltIn$dateBI$DateParser.parse(BuiltIn.java:330)
at freemarker.core.BuiltIn$dateBI$DateParser.get(BuiltIn.java:301)
at freemarker.core.BuiltIn$dateBI$DateParser.exec(BuiltIn.java:312)
at
freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
Here is what the GeoServer WFS looks like...
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs"
xmlns:wfs="http://www.opengis.net/wfs" xmlns:postgis="http://www.mtri.org"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd
http://www.mtri.org
http://localhost:8080/geoserver/wfs/DescribeFeatureType?typeName=postgis:t_inet_weu">
<gml:boundedBy>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates xmlns:gml="http://www.opengis.net/gml"
decimal="." cs="," ts=" ">7.38638878,43.72754669
7.43929338,43.7730484</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<postgis:t_inet_weu fid="t_inet_weu.100">
<postgis:inet_p100>47.8</postgis:inet_p100>
<postgis:name>Monaco</postgis:name>
<postgis:rpt_year>2002</postgis:rpt_year>
<postgis:the_geom>
<gml:MultiPolygon
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates
xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts="
">7.39160919,43.72754669 7.38638878,43.74194336 7.38638878,43.74555206
7.38777733,43.74860382 7.40305519,43.76138306 7.41611099,43.77055359
7.41999912,43.77249908 7.42472172,43.7730484 7.42944431,43.77138519
7.43249989,43.76916504 7.43833256,43.76027679 7.43929291,43.75752258
7.4230547,43.73999786 7.41749954,43.73416138
7.39160919,43.72754669</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</postgis:the_geom>
<postgis:rpt_year_date>2002-04-02</postgis:rpt_year_date>
<postgis:rpt_year_timestamp>2002-04-04T04:40:45</postgis:rpt_year_timestamp>
</postgis:t_inet_weu>
</gml:featureMember>
...
</wfs:FeatureCollection>
--
View this message in context: http://www.nabble.com/KML-time-template-is-truncating-seconds-tf4373935.html#a12467482
Sent from the GeoServer - Dev mailing list archive at Nabble.com.