On Thu, 5 Aug 2021 at 09:01, Florian Kaselow <
florian.kase...@data-experts.de> wrote:

> Hello geotools user,
>
> I want to request features from a geopackage. The features In the
> geopackage contain an timestamp attribute which is specified with time zone
> UTC+2 .
> In the filter of my query there is a timestamp specified in also with the
> time zone UTC+2.
> Example of a filter and the resulting where clause (using:
> org.geotools.geopkg.GeoPackage.reader(FeatureEntry, Filter, Transaction)
>  GeoTools Version 22.3):
>
> Filter: [ timeattribute < Fri May 24 13:48:59 CEST 2019 ]
> SQL where: ("timeattribute" < datetime('2019-05-24 13:48:59.0','localtime')
>
> In the SQL will be final the following where clause: "timeattribute" <
> '2019-05-24 1*5*:48:59.0')
>
> Geotools seems to ignore the time zone of the timestamp in the filter
> specification.
> In the GeoPackage, the time is apparently evaluated as UTC and changed
> accordingly by +2 hours and incorrect features are determined from the
> GeoPackage.


It seems as if GeoTools *is* taking the timezone into account and correctly
converting it to UTC - this is why we usually recommend storing times as
UTC in the database . There is a long thread in the archives somewhere from
when I went through all the JDBC code and made sure it was doing the
"right" thing regardless of what timezone the request came from so that
this was not a problem any more. Since the GeoPackage datastore inherits
all of those tests I would expect it to be working correctly.

Ian
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to