Opened 6 years ago

Closed 6 years ago

Last modified 4 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 6 years ago.
Example of not working mif
gdal-4257.patch (913 bytes) - added by Daniel Morissette 6 years ago.
Patch committed against MITAB upstream

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by magerlin

Attachment: Husn.zip added

Example of not working mif

comment:2 Changed 6 years ago by jcrepetto

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 Changed 6 years ago by Even Rouault

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 Changed 6 years ago by Daniel Morissette

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

comment:5 Changed 6 years ago by Even Rouault

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

comment:6 Changed 6 years ago by Daniel Morissette

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

Changed 6 years ago by Daniel Morissette

Attachment: gdal-4257.patch added

Patch committed against MITAB upstream

comment:7 Changed 6 years ago by Daniel Morissette

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 Changed 6 years ago by Even Rouault

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 Changed 4 years ago by Even Rouault

Milestone: 1.8.2

Milestone 1.8.2 deleted

Note: See TracTickets for help on using tickets.