Monday 9 September 2019

ogr - How to debug ogr2ogr ERROR 1: Did not get at least 2 values or invalid number of set of coordinates?


I'm trying to convert a government data contour GML (http://geo.data.linz.gv.at/katalog/geodata/hoehenschichten/2011/1m-Hoehenschichten.gml) to Shapefile.


It seems like it was created by FME:







67741.3127211605 341935.72972973 245
79959.5666279546 360502.420825918 602




434
2987.20354766336



68485.5237522595 355869.11751307 434 68487 355867.757575758 434 68488.6860465116 355866 434 68492 355862.369426752 434 68493.6929133858 355861 434 68497 355858.324840764 434 68498.921052631$





Ogrinfo (OGR 1.9) recognizes multi line strings:


> ogrinfo 1m-Hoehenschichten.gml 
Had to open data source read-only.
INFO: Open of `1m-Hoehenschichten.gml'

using driver `GML' successful.
1: Contour (Multi Line String)

But


 ogr2ogr -f "ESRI Shapefile" -nlt MULTILINESTRING25D  -skipfailures  out 1m-Hoehenschichten.gml Contour

fails with


ERROR 1: Did not get at least 2 values or invalid number of
set of coordinates 68485.5237522595 355869.11751307 434 68487 355867.757575758 434 68488.6860465116 355866 434 68492 355862.369426752 434 68493.6929133858 355861 434 68497 355858.324840764 434 68498.9210526316 355856 434 68502 355851.9375 434 68502.5818965517 355851 434 68503.5340909091 355849.465909091 434 68505.6853448276 355846 434 68507 355843.896551724 434 68509.2459893048 355841 434 68512 355836.846774194 434 ....


My interpretation so far is that OGR does not recognize that the file contains 3D geometries.


How can I find out if the file is broken or whether I'm dealing with an OGR bug/missing feature?



Answer



Add -dim 3 to force the coordinate dimension to 3D for both the layer geometry type, and feature geometries.


This option requires GDAL 1.10, which is currently in development.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...