Skip to content

Geometry supported by ogr2ogr not supported by gdal-next #13

@ekulno

Description

@ekulno

I have a GML file which I want to convert to another format. I am able to do this with the ogr2ogr tool, but with gdal-next I get an error when I try to do the same thing.

With ogr2ogr:

$ ogr2ogr -f GeoJSON test.json test.gml && cat test.json
{
"type": "FeatureCollection",
"name": "_",
"features": [
{ "type": "Feature", "properties": { "gml_id": "" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ], [ 7.0, 8.0 ], [ 1.0, 2.0 ] ] ] } }
]
}

With gdal-next:

const gdal = require("gdal-next");
const dataset = gdal.open('test.gml', 'r', "GML");
const feature = dataset.layers.get(0).features.get(0);
const geometry = feature.getGeometry();

I get the following error for the getGeometry call:

Error: Tried to create unsupported geometry type

test.gml has the following content.

<CityModel>
    <cityObjectMember>
        <_ gml:id="">
            <gml:Polygon
                xmlns:gml="http://www.opengis.net/gml">
                <gml:exterior>
                    <gml:Ring>
                        <gml:curveMember>
                            <gml:Curve>
                                <gml:segments>
                                    <gml:LineStringSegment>
                                        <gml:posList srsDimension="2">1 2 3 4</gml:posList>
                                    </gml:LineStringSegment>
                                    <gml:Arc>
                                        <gml:posList srsDimension="2">3 4 5 6 7 8</gml:posList>
                                    </gml:Arc>
                                    <gml:LineStringSegment>
                                        <gml:posList srsDimension="2">7 8 1 2</gml:posList>
                                    </gml:LineStringSegment>
                                </gml:segments>
                            </gml:Curve>
                        </gml:curveMember>
                    </gml:Ring>
                </gml:exterior>
            </gml:Polygon>
        </_>
    </cityObjectMember>
</CityModel>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions