1

I cannot make ogr2ogr.exe work. I'm using GDAL 1.11.

I keep getting the following error message:

ERROR 1: Did not get at least 2 values or invalid number of set of coordinates 709993.98 6181946.65 32.36 709990.65 6181946.07 32.36 709992.47 6181935.8 32.36 709995.78 6181936.38 32.36 709993.98 6181946.65 32.36 ERROR 1: Invalid exterior ring

I run the following command:

C:\Python34\Lib\site-packages\osgeo\ogr2ogr.exe -skipfailures -nlt MULTILINESTRING25D -dim 3 -f "DXF" -a_srs "EPSG:25832" -spat 711000 6168300 713000 6168600 -geomfield posList bygning.DXF Bygning.gml

I'm working on a relatively big file 4.2GB.

UPDATE: Example of data to import

<gml:surfaceProperty>
    <gml:Surface srsName="EPSG:25832" srsDimension="3">
        <gml:patches>
            <gml:PolygonPatch>
                <gml:exterior>
                    <gml:LinearRing>
                        <gml:posList>
                            710820.22 6180637.52 36 710818.14 6180633.83 36 710825.47 6180629.71 36 710827.55 6180633.4 38.25 710828.6 6180637.3 38.25 710825.18 6180638.36 38.25 710824.22 6180635.27 36 710820.22 6180637.52 36
                        </gml:posList>
                    </gml:LinearRing>
                </gml:exterior>
            </gml:PolygonPatch>
        </gml:patches>
    </gml:Surface>
</gml:surfaceProperty>

Does the GML3 driver in org2ogr support surfaces?

UPDATE 2 - making it simple

I tried making a gml consisting of only one feature, same namespace etc. as before. I then output the feature to WKT.

Output WKT

"POLYGON ((711383.39 6182528.23,36.49 711379.31,6182528.35 36.48,711379.06 6182520.08,36.48 711383.15,6182519.97 36.48,711383.37 6182527.56,36.49 711383.39,6182528.23 36.49))"

Input GML http://pastebin.com/76AGLWH0

Cleary the commas is placed in the wrong positions. The z-coordinate of the first point is parsed as the x-coordinate of the second feature. If I add -dim 3 or -nlt GEOMETRY, it adds zeroes.

BR Thomas

10
  • Should be no problem according to gis.stackexchange.com/questions/3942/…. It would help a lot if you could isolate one failing polygon, save it as complete GML file with all the xmlns stuff etc. and share it with us.
    – user30184
    Commented Aug 5, 2014 at 16:10
  • I'll try to see if I can get the data out of my 4.2GB file. I'm also having trouble locating some definition of GML3 and GML3 SF. I'm not sure PolygonPatches are supported by Ogr2ogr.
    – Bildsoe
    Commented Aug 5, 2014 at 17:37
  • I found a definition here: portal.opengeospatial.org/files/?artifact_id=15201 and it seems PolygonPatches is part of GML3.1.1 SF
    – Bildsoe
    Commented Aug 5, 2014 at 17:46
  • They are supported since version 1.8.0 upstream-tracker.org/changelogs/gdal/1.8.0/changelog.html The error speaks about number of coordinates. How about adding srsDimension="3" also after posList?
    – user30184
    Commented Aug 5, 2014 at 17:55
  • I found an example of 2D surface with polygon patch from ESRI China site bbs.esrichina-bj.cn/esri/… and ogr2ogr reads the polygon from the 3 layer GML without problem.
    – user30184
    Commented Aug 5, 2014 at 18:03

1 Answer 1

1

The problem is caused by GDAL which seems to require that 3-dimensional coordinates are specified in GML at position level as

<gml:posList srsDimension="3">

In the data dimensions are expressed only at geometry level

 <gml:Surface srsName="EPSG:25832" srsDimension="3">

This may be a bug or missing feature in GDAL and corresponding GDAL ticket http://trac.osgeo.org/gdal/ticket/5606 will show the resolution. First aid for making the data readable for GDAL is to add srsDimensions attribute to occasions of "posList" with a text editor.

<gml:posList>  =>  <gml:posList srsDimension="3">
1
  • I have tried it on a large scale - I did this on a 4.2GB file and it worked perfectly.
    – Bildsoe
    Commented Aug 6, 2014 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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