I have a GML file that seems to mix

<gml:posList srsDimension="2">



records. OGR2OGR (understandably) crashes when reading these files:

ERROR 1: Did not get at least 3 values or invalid number of set of coordinates <gml:posList>205962.585 476394.629 205957.111 476398.377 205946.834 476405.243 205947.315 476406.680 205945.326 476407.938 205945.374 476407.563 205945.320 476407.086 205944.605 476405.688 205940.987 476399.969 205938.375 476395.992 205937.806 476395.734</gml:posList>

I've seen other questions on this subject (How to debug ogr2ogr ERROR 1: Did not get at least 2 values or invalid number of set of coordinates?), suggesting to add -dim 2 to the OGR2OGR commandline, but this doesn't seem to work. OSGeo4W is up-to-date, and using GDAL 1.10 / 1.11 / 2.00 / 2.01.

C:\OSGeo4W64\bin\ogr2ogr -dim 3 -f "PostgreSQL" PG:"host=dbserver user=test password=test dbname=db" mygml.gml -dim 3 -overwrite -progress

It seems the parameter is completely ignored. All objects are 2D, so this line (with -dim 3) should fail on the first object; it doesn't. Setting this to 2 also doesn't change anything. (I added two -dim parameters as a test - also doesn't change anything).

Simply skipping objects (--skipfailures) isn't really an option since I have no idea how many objects are affected.

I have about 50GB worth of GML meaning a simple open & replace job is quite hard.

Does anyone know why OGR2OGR ignores my parameter, or can perhaps offer another solution?


Again I answer my own question.

See the ticket at https://trac.osgeo.org/gdal/ticket/6597

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.