[Geoserver-devel] KML time template is truncating seconds

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&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot; xmlns:postgis="http://www.mtri.org"
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
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&quot;&gt;
    <gml:boundedBy>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
            <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot;
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&quot;&gt;
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates
xmlns:gml="http://www.opengis.net/gml&quot; 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.

Hi Tyler,

This is related to the following bug:

http://jira.codehaus.org/browse/GEOS-1290

There is currently a silly conversion that is going on internally that
is dropping some of the information on the date.

I will try to throw this bug report higher on the priority list.

-Justin

Tyler Erickson wrote:

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&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot; xmlns:postgis="http://www.mtri.org"
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
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&quot;&gt;
    <gml:boundedBy>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
            <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot;
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&quot;&gt;
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates
xmlns:gml="http://www.opengis.net/gml&quot; 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>

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Tyler Erickson ha scritto:

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?

I think so, but I'd appreciate if you could open a jira issue with the
contents of this mail and schedule it for fixing by 1.5.4 and 1.6.0beta3 (so that I won't forget addressing it, there is lots going on these days).

Cheers
Andrea

Andrea,

Justin pointed out there already is a jira issue open:
http://jira.codehaus.org/browse/GEOS-1290

Thanks,
Tyler

aaime wrote:

Tyler Erickson ha scritto:

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?

I think so, but I'd appreciate if you could open a jira issue with the
contents of this mail and schedule it for fixing by 1.5.4 and 1.6.0beta3
(so that I won't forget addressing it, there is lots going on these days).

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
View this message in context: http://www.nabble.com/KML-time-template-is-truncating-seconds-tf4373935.html#a12514141
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

I appear to be having this problem again (i.e. seconds are truncated) with
GeoServer 1.7.x
I am not able to reopen http://jira.codehaus.org/browse/GEOS-1290
could someone reopen the jira item, or should I create a new jira item?

- Tyler

Tyler Erickson wrote:

Andrea,

Justin pointed out there already is a jira issue open:
http://jira.codehaus.org/browse/GEOS-1290

Thanks,
Tyler

--
View this message in context: http://www.nabble.com/KML-time-template-is-truncating-seconds-tp12467482p18530575.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

Hi Tyler,

I re-opened the issue. I will look into it shortly.

-Justin

Tyler Erickson wrote:

I appear to be having this problem again (i.e. seconds are truncated) with
GeoServer 1.7.x
I am not able to reopen http://jira.codehaus.org/browse/GEOS-1290 could someone reopen the jira item, or should I create a new jira item?

- Tyler

Tyler Erickson wrote:

Andrea,

Justin pointed out there already is a jira issue open:
http://jira.codehaus.org/browse/GEOS-1290

Thanks,
Tyler

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com