[Geoserver-devel] GeoServer Shapefile output format

I've recently made a change to the GeoServer Shapefile output format code to
use the RetypingFeatureCollection to cast all Timestamps to Strings for a
project I'm working on. This is to avoid the issue with the all datetime
fields only persisting the date portion of the value in the DBF associated
with the shapefile zip package - something anyone who has worked with
shapefiles I'm sure finds highly frustrating. I got really tired of
doubling up layers with SQL views to cast all datetime fields to string for
the purpose of shapefile exports...

Is this something any one else would find useful? I had originally coded
the functionality it to be enabled through the use of a format_options key,
but decided there was never a case I wouldn't want to do this as precision
is lost.

Cheers,

-----
Jonathan Meyer
Senior Software Engineer
Applied Information Sciences
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GeoServer-Shapefile-output-format-tp5181183.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

On Tue, Jan 13, 2015 at 6:00 AM, gisjon <jon@anonymised.com> wrote:

I've recently made a change to the GeoServer Shapefile output format code
to
use the RetypingFeatureCollection to cast all Timestamps to Strings for a
project I'm working on. This is to avoid the issue with the all datetime
fields only persisting the date portion of the value in the DBF associated
with the shapefile zip package - something anyone who has worked with
shapefiles I'm sure finds highly frustrating. I got really tired of
doubling up layers with SQL views to cast all datetime fields to string for
the purpose of shapefile exports...

Is this something any one else would find useful? I had originally coded
the functionality it to be enabled through the use of a format_options key,
but decided there was never a case I wouldn't want to do this as precision
is lost.

I think it would be useful to some, but would also break others.
If you look in the shepefile data store
there is a system variable you can set to make it dump timestamps
using the "@" type (timestamp in dbase7 format,
http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm)

We don't do that by default because few shapefile readers can deal with
that format, the shapefile spefication being based on dbase 3.

So I guess having an option to dump timestamps as strings makes sense,
but I believe it should stay an option, as with the extra precision you also
lose the information that the field is temporal.

So... I'd resume the format option, and submit a pull request :slight_smile:

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.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.

-------------------------------------------------------

Andrea,

Sorry I dropped off for awhile on this shapefile conversation. I was
wanting to add some unit tests, but wondered if I could get a pointer as to
how I'd test the shapefile with data including time. I looked through where
I understood all the test data to come from
/test/java/org/geoserver/data/test/ but didn't see any vector dataset with
time. It looked like I could just define a new .properties file with sample
dataset to test functionality. I'd then put a reference to it in TYPENAMES
under CiteTestData.java to be able to expose to unit test code?

As a recap, here is the current implementation:

- New checkbox within WFS Admin page to enable datetime string retyping,
disabled by default
- New format_option parameter "SHPDATETOSTR" will override the above
setting.
- Only java.sql.Timestamp fields will be retyped to String, Date fields will
be left alone.
- Localization added for the new admin page checkbox label for all
configured languages.

Thanks,
Jonathan

-----
Jonathan Meyer
Senior Software Engineer
Applied Information Sciences
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GeoServer-Shapefile-output-format-tp5181183p5207190.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.