8

I have a very large .gml file with multiple layers in it. I would like to export one of these layers to .shp. It is a polygon layer (of lakes). However, I am getting the error:

ERROR 1: Unrecognised geometry type <Surface>.

The ogr command I was using: ogr2ogr -f "ESRI Shapefile" output.shp input.gml layername

Any thoughts? Is it possible the polygon layer is somehow incorrectly defined as a surface in the GML? Any way I can force it to be a polygon? Or is it something else entirely? I don't often work with .gml, so may be missing something obvious...

EDIT 20101202: Here is a snip of (what appears to be) the relevant info from an example feature in the example file linked below:

<gml:featureMember>
    <gml:surfaceProperty>
        <gml:Surface srsName="EPSG:4140" srsDimension="2">
            <gml:patches>
                <gml:PolygonPatch>
                    <gml:exterior>
                        <gml:LinearRing>
                           <gml:posList>
                               52.2023177 -77.596532 52.2024007 -77.5963559 52.2028141 -77.5962899 52.2028362 -77.5964181 52.2026119 -77.5967049 52.2024106 -77.5967968 52.2023273 -77.5966966 52.2023177 -77.596532
                           </gml:posList>
                        </gml:LinearRing>
                    </gml:exterior>
             </gml:PolygonPatch>
        </gml:patches>
    </gml:Surface>
</gml:surfaceProperty>

So, the file is identifying it as a 'surface' as well as a 'PolygonPatch'? Perhaps the question should be: what is a 'surface' in a .gml file?

9
  • What is the output of "ogrinfo input.gml -ro -al"? Commented Nov 29, 2010 at 14:36
  • ogrinfo gives the same "ERROR 1: Unrecognised geometry type <Surface>." Commented Nov 29, 2010 at 15:18
  • Are you using the latest version of GDAL/OGR? gdal.org/ogr/drv_gml.html Commented Nov 29, 2010 at 15:32
  • I am using 1.7.0b2 Commented Nov 29, 2010 at 16:44
  • Can you post a sample of the GML or a link to the file?
    – DavidF
    Commented Nov 30, 2010 at 15:17

2 Answers 2

6

You need to use GDAL 1.8.0 or above to be able to read this kind of GML3 geometry.

1
  • if somebody knows, that's you Even :) Commented Jun 25, 2011 at 19:34
5

Looks like you have GML3 but ogr2ogr is expecting it to be GML2. According to the docs (http://www.gdal.org/ogr/drv_gml.html) only GML 2 or GML 3 Simple Feature is supported, since GML3 SF doesn't support surfaces either I'd say you are out of luck.

I'm also not entirely sure if a shapefile can support surfaces either so I suspect that you are going to run into problems with any solution trying to go this way.

3
  • The issue is that the feature should be a polygon, according to all of the documentation I can find. It appears that OGR is identifying it incorrectly as a surface when it shouldn't. Commented Nov 30, 2010 at 12:59
  • 1
    It seems more likely that the documentation of your data is wrong than OGR is misreading "polygon" as "surface" but a quick grep of the data file should solve the issue.
    – Ian Turton
    Commented Nov 30, 2010 at 16:15
  • I have pasted a snippit into the original question. Commented Dec 2, 2010 at 16:18

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.