[gdal-dev] PostGIS date field output

Kralidis,Tom [Ontario] Tom.Kralidis at ec.gc.ca
Fri Mar 1 08:12:06 PST 2013



> -----Original Message-----
> From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-
> bounces at lists.osgeo.org] On Behalf Of Stephen Woodbridge
> Sent: Thursday, February 28, 2013 16:56
> To: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] PostGIS date field output
> 
> On 2/28/2013 4:40 PM, Kralidis,Tom [Ontario] wrote:
> > 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.
> 
> Tom,
> 
> Can you cast it to a string in sql so it gets passed through a text?
> 
> -Steve W

Steve: thanks for the suggestion.  FYI Even has since implemented a fix
in
https://github.com/OSGeo/gdal/commit/fb3f860779c9ef736c42750b9e7199baebc
44216

Thanks

..Tom



More information about the gdal-dev mailing list