[Geoserver-users] WMS GetFeatureInfo changes date value

Hi

If you sent a GetFeatureInfo-request to a layer that have a column with the
date-format in a PostGisDatabase, Geoserver sometimes add a time to the
date. This is a problem when it is changed into UTC-time and the date is
changed which happens with json.

INFO_FORMAT result
text/html 2017-06-01 00:00
text/plain 2017-06-01
text/xml 2017-06-01
application/vnd.ogc.gml 2017-06-01
application/json 2017-05-31Z
  
Postgis (date) 2017-06-01

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html

Hi,

I made a few tests for this, GeoJson (this also stands for GML 3.1 and GML 3.2) have the correct default behavior,
i.e. they take into account the timezone when encoding a date \ time attribute.

The following formats: text/html, text/plain, text/xml and application/vnd.ogc.gml (GML2), don’t have any special
treatment for date \ times and simply do a to string regardless of the timezone or time format. In my opinion this
is a bug and deserves a JIRA ticket (maybe one already exists).

In case someone wants to take a look at the code, for example the text/plain output format:
https://github.com/nmco/geoserver/blob/8d5c1dbc774e68baf445354bcb5e5fc2d5c122e3/src/wms/src/main/java/org/geoserver/wms/featureinfo/TextFeatureInfoOutputFormat.java#L106-L135

For the well behaved formats (GeoJson, GML 31 and GML 32) it is possible to control if GeoServer will or will not
take into account the the time zone when encoding date \ time attributes using this Java property:

-Dorg.geotools.localDateTimeHandling=true

This will make GeoServer stop converting the data \ time to UTC-time, which should give you the results you are expecting.

Regards,

Nuno Oliveira

···

On 09/29/2017 02:09 PM, perre wrote:

Hi

If you sent a GetFeatureInfo-request to a layer that have a column with the
date-format in a PostGisDatabase, Geoserver sometimes add a time to the
date. This is a problem when it is changed into UTC-time and the date is
changed which happens with json.

INFO_FORMAT	                result
text/html	                       2017-06-01 00:00
text/plain	                       2017-06-01
text/xml	                       2017-06-01
application/vnd.ogc.gml    2017-06-01
application/json	              2017-05-31Z
	
Postgis (date)	2017-06-01

--
Sent from: [http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html](http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! [http://sdm.link/slashdot](http://sdm.link/slashdot)
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: [http://www.ianturton.com/talks/foss4g.html#/](http://www.ianturton.com/talks/foss4g.html#/)
- The GeoServer user list posting guidelines: [http://geoserver.org/comm/userlist-guidelines.html](http://geoserver.org/comm/userlist-guidelines.html)

[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)

-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_it](http://twitter.com/geosolutions_it)

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
 
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

On Tue, Oct 3, 2017 at 10:31 AM, Nuno Oliveira <
nuno.oliveira@anonymised.com> wrote:

For the well behaved formats (GeoJson, GML 31 and GML 32) it is possible
to control if GeoServer will or will not
take into account the the time zone when encoding date \ time attributes
using this Java property:

-Dorg.geotools.localDateTimeHandling=true

This will make GeoServer stop converting the data \ time to UTC-time,
which should give you the results you are expecting.

Yep... would be nice to have that as a config flag in the UI (as opposed to
a system variable).
And yes, it's hard for many to come to terms to it, but dates do have a
timezone too, as I'm writing now
it's Tuesday here and in most of the world, but in Honolulu, it's still
Monday.

For international tenders there is even a special timezone used for
deadlines known as AOE (Anywhere
On Earth), when a date is chosen to be the deadline for presenting an
offer, it's often associated to AOE
to avoid the confusion of just stating a date:

Cheers
Andrea

==
GeoServer Professional Services from the experts! Visit GeoSolutions Enterprise Support Services
for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.