[gdal-dev] PostGIS date field output

Kralidis,Tom [Ontario] Tom.Kralidis at ec.gc.ca
Thu Feb 28 13:40:52 PST 2013


Hi: we are using 1.9.2 via MapServer WFS to serve out PostGIS data in
GeoJSON, which works very well -- great feature!

I was having issues with GeoJSON output on date fields when hour is <
10. 

Digging deeper:

The column in question is of PostgreSQL type 'timestamp without time
zone'.  When querying the data in psql, I get:

mydatetime: 2013-02-19 01:03:34

When I do an ogrinfo the same is shown as:

mydatetime (DateTime) = 2013/02/19  1:03:34

The month is zero padded, but not the hour.  I would have expected it to
be consistent one way or the other.   Naturally, any format which OGR
writes to carries this format.

Our downstream UI (in this case) has to implement a workaround, as it
expects zero padded hour values.

Is this by design in GDAL/OGR?  Is there any we can do to output hour
values zero padded in this case?  I'd rather not have the front end have
to fix this, and using MapServer WFS out of the box leaves us little
options for custom scripting.

Thanks

..Tom



More information about the gdal-dev mailing list