Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#4257 closed defect (fixed)

[PATCH] OGR2OGR can not handle MIF with tab delimited coordinates in the data section

Reported by: magerlin Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SRS Version: svn-trunk
Severity: blocker Keywords: ogr2ogr MIF
Cc: Daniel Morissette

Description

Attached MIF fil has tab delimited coordinates in the data section. Using Ogr2Ogr issue an error message like : invalid point line: 'Point 717209.72218590346000 6169640.53685910910000' Segmentation fault.

If I change the tabs to blanks in a text editor then OGR2OGR can handle the MIF file like a charm!

Attachments (2)

Husn.zip (31.4 KB ) - added by magerlin 13 years ago.
Example of not working mif
gdal-4257.patch (913 bytes ) - added by Daniel Morissette 13 years ago.
Patch committed against MITAB upstream

Download all attachments as: .zip

Change History (11)

by magerlin, 13 years ago

Attachment: Husn.zip added

Example of not working mif

comment:2 by jcrepetto, 13 years ago

Hi,

This patch should solve the problem :

Index: ogr/ogrsf_frmts/mitab/mitab_miffile.cpp
===================================================================
--- ogr/ogrsf_frmts/mitab/mitab_miffile.cpp	(révision 23099)
+++ ogr/ogrsf_frmts/mitab/mitab_miffile.cpp	(copie de travail)
@@ -1331,7 +1331,8 @@
         {
             // Special case, we need to know two lines to decide the type
             char **papszToken;
-            papszToken = CSLTokenizeString(pszLine);
+            papszToken = CSLTokenizeStringComplex(pszLine," \t",
+                                                      TRUE,FALSE);
             
             if (CSLCount(papszToken) !=3)
             {

comment:3 by Even Rouault, 13 years ago

Cc: Daniel Morissette added
Summary: OGR2OGR can not handle MIF with tab delimited coordinates in the data section[PATCH] OGR2OGR can not handle MIF with tab delimited coordinates in the data section

CC'ing Daniel so he has a chance to review the patch.

comment:4 by Daniel Morissette, 13 years ago

The patch makes sense. Are you able to commit the fix in MITAB upstream Even?

comment:5 by Even Rouault, 13 years ago

Not sure I have commit rights there, and not sure to remember how to reach MITAB CVS by the way ;-)

comment:6 by Daniel Morissette, 13 years ago

Checking the source quickly... I'll come back with an updated patch...

by Daniel Morissette, 13 years ago

Attachment: gdal-4257.patch added

Patch committed against MITAB upstream

comment:7 by Daniel Morissette, 13 years ago

I just attached a new patch that addresses another case that was not addressed, and uses the (hopefully) cheaper CSLTokenizeString2() function which is also used elsewhere by MITAB.

This has been committed upstream but I have to leave now and do not have time to commit in OGR. Please go ahead if you want, otherwise I'll try to do it tomorrow.

comment:8 by Even Rouault, 13 years ago

Milestone: 1.8.2
Resolution: fixed
Status: newclosed

r23110 /trunk/gdal/ogr/ogrsf_frmts/mitab/ (mitab_feature.cpp mitab_middatafile.cpp mitab_miffile.cpp): Resync with upstream MITAB CVS to fix problem with tab delimiter used in MIF files (GDAL #4257)

r23111 /branches/1.8/gdal/ogr/ogrsf_frmts/mitab/mitab_miffile.cpp: fix problem with tab delimiter used in MIF files (GDAL #4257)

comment:9 by Even Rouault, 11 years ago

Milestone: 1.8.2

Milestone 1.8.2 deleted

Note: See TracTickets for help on using tickets.