#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)
Change History (11)
by , 13 years ago
comment:1 by , 13 years ago
comment:2 by , 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 , 13 years ago
Cc: | 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 , 13 years ago
The patch makes sense. Are you able to commit the fix in MITAB upstream Even?
comment:5 by , 13 years ago
Not sure I have commit rights there, and not sure to remember how to reach MITAB CVS by the way ;-)
comment:7 by , 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 , 13 years ago
Milestone: | → 1.8.2 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
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)
Example of not working mif