[Qgis-user] Saving GPX as SHP looses the time part of the (date)time field

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Wed Feb 5 01:16:52 PST 2014


Alexandre Neto <senhor.neto at ...> writes:

> 
> I got into this problem early today. Trying to save a GPX as SHP I loose
the time part of the time Field, and only the date is saved as a string.
> Instead of getting a string like this: "2013-11-21T10:00:25" all I get is
"2013-11-21".
> 
> I suspected that this had something to do with GDAL\OGR, and I found a bug
about this exact problem.
> 
> 
> http://trac.osgeo.org/gdal/ticket/2968
> 
> 
> In the end of the ticket report, a possible solution is given to allow
ogr2ogr to cast the DateTime filed as a string, I think this might be
preferable within QGIS, to ensure no data is lost. Should I fill a Feature
request in Redmine?


Hi,

I believe that this is not an accurate description: "only the date is saved
as a string" but it is rather "only the date is saved as 'date'"
I am not sure how much it is a bug because the dbf format that shapefile is
using for storing the attributes simply does not support DateTime but only
Date. There are two alternatives which you have recognized: to keep the
datatype close to original (DateTime -> Date) and loose the time part, or
change the datatype into string. Neither solution can make everybody happy.
One solution could be to make it selectable. For some use cases it could be
nice to write the date part into date column and only time part into a
separate string column. But if you do not necessarily need just shapefiles a
better alternative would be to convert data into Spatialite.

-Jukka Rahkonen-





More information about the Qgis-user mailing list