Opened 16 years ago

Closed 15 years ago

#2585 closed defect (fixed)

MapInfo doesn't support writing DateTime type

Reported by: GladaFrasse Owned by: aboudreault
Priority: normal Milestone: 1.6.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: mapinfo datetime
Cc: Daniel Morissette, warmerdam

Description

I tried to convert/import an gpx file to mapinfo format. I have used FWtools2.2.6 and called the ogr2ogr with argument -f "MapnInfo File" test.tab tann15.gpx When run I get error and the message was "Error 1:IMapInfoFile::CreateField() called with unsupported field type 11." Does it mean that cant support gpx-files or does it med that it's missing some arguments to separate data?

I can send a file if someone want it.

/Frasse

Attachments (1)

Tann15.gpx (583.9 KB ) - added by GladaFrasse 16 years ago.
file tried to convert to mapinfo

Download all attachments as: .zip

Change History (10)

by GladaFrasse, 16 years ago

Attachment: Tann15.gpx added

file tried to convert to mapinfo

comment:1 by warmerdam, 16 years ago

Cc: Daniel Morissette added
Component: defaultOGR_SF
Keywords: mapinfo datetime added

Field type 11 is OFTDateTime. The failures means that MapInfo does not have a specific datetime type.

I believe you should be able to add the -skipfailures switch on the ogr2ogr commandline to make it ignore errors creating unsupported field types, though you will loose the datetime field(s).

I'm not exactly clear on our protocol, but I think might be desirable for the mapinfo CreateField() method to fallback to creating fields requested as datetime as strings of an appropriate length.

comment:2 by Even Rouault, 16 years ago

Summary: GPX import failureMapInfo doesn't support writing DateTime type

I confirm that the GPX driver can read successfully the file. Changing the title to reflect that

comment:3 by Daniel Morissette, 16 years ago

Milestone: 1.6.0
Owner: changed from warmerdam to aboudreault

The latest MITAB supports the DateTime field type. I think we just need to add proper type mapping in TABFile::SetFeatureDefn (mitab_tabfile.cpp) and MIFFile::SetFeatureDefn (mitab_miffile.cpp).

Assigning to Alan to fix this in MITAB. We'll port the fix to GDAL/OGR after.

comment:4 by warmerdam, 16 years ago

Cc: warmerdam added

comment:5 by aboudreault, 16 years ago

This has been fixed in MITAB. Keep this ticket open until we merge the current mitab dev version in GDAL.

comment:6 by Daniel Morissette, 15 years ago

Resolution: fixed
Status: newclosed

I have upgraded the ogr/ogrsf_frmts/mitab driver this morning with a snapshot of the current MITAB CVS (2.0.0-dev). This fix should be in as well.

comment:7 by Daniel Morissette, 15 years ago

Resolution: fixed
Status: closedreopened

Reopening. Looks like we added support for writing OFTDateTime but didn't add support for properly mapping the field type in read mode.

comment:8 by Daniel Morissette, 15 years ago

While working on this, we have discovered that OGR's OFTDateTime carries only seconds but not milliseconds. This means that if we switch MITAB to use OFTDateTime instead of the current implementation that carries time as strings internally then we'll lose the milliseconds and users of MITAB outside of the OGR environment will complain.

Ticket #2680 has been created about adding more precision to OFTDateTime in a future release.

In the meantime, unless someone comes up with a better idea, we'll have to add the support for OFTDateTime inside #ifdef MITAB_USE_OFTDATETIME and enable it only in the ogrsf_frmts/mitab/GNUmakefile to enable this only when the code is built as part of OGR. By default, we'll continue to carry the TABFDateTime and TABFTime types as strings internally in MITAB when used outside of the OGR environment.

comment:9 by Daniel Morissette, 15 years ago

Resolution: fixed
Status: reopenedclosed

I have updated the ogrsf_frmts/mitab source with Alan's fixes to support OFTDate/OFTTime/OFTDateTime in both read and write access. The code is inside #ifdef MITAB_USE_OFTDATETIME and I have added -DMITAB_USE_OFTDATETIME to the GNUmakefile and makefile.vc to enable it when building the MITAB driver in OGR.

Note that the current implementation could use some performance optimization to avoid an unnecessary conversion of the values to strings. This will be done after GDAL 1.6.0 and will be tracked in http://bugzilla.maptools.org/show_bug.cgi?id=1948

Note: See TracTickets for help on using tickets.