Ticket #2968 (closed defect: fixed)
OGR GPX driver loses time field in shapefile
| Reported by: | hamish | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.7.0 |
| Component: | OGR_SF | Version: | 1.5.2 |
| Severity: | normal | Keywords: | gpx |
| Cc: |
Description
Hi,
thanks for looking at the two GPX issues I reported yesterday. Here's another one for you:
If using ogr2ogr to convert a GPX file containing a track into a shapefile the 'time' Field gets broken and you end up with no time data in the shapefile's DBF.
for example:
$ ogr2ogr -f "ESRI Shapefile" test_trk_shp test_trk.gpx Warning 6: Field time create as date field, though DateTime requested. Warning 6: Field time create as date field, though DateTime requested. Warning 6: Field time create as date field, though DateTime requested.
$ dbview -e test_trk_shp/track_points.dbf | head Field Name Type Length Decimal Pos track fid N 11 0 track seg N 11 0 track seg N 11 0 ele N 24 15 time D 8 0 magvar N 24 15 geoidheigh N 24 15 name C 80 0 cmt C 80 0 ...
# DBF contains records 4000 data points, half with no timestamp (doh!) $ dbview track_points.dbf | grep '^time' | uniq time : 00000000 time :
i.e. when the <time> GPX element is missing from the <trkpt> "00000000" is written. when a <time> value is in the <trkpt> record it is written empty.
good times look like:
<time>2009-04-28T06:31:53Z</time>
and for many needs recording time to the nearest second is needed. e.g. we are adding spatial data to recording equipment logs which record timestamps but are not directly connected to the GPS.
if DateTime? is not available could it write to (e.g.) varchar(255) instead?
thanks, Hamish

