Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6474 closed defect (invalid)

OSM: layer lines not found

Reported by: tobwen Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.0.2
Severity: normal Keywords:
Cc:

Description

I'm trying to parse the attached OSM file using GDAL 2.0.2, released 2016/01/26.

With this line gr2ogr -f GeoJSON /vsistdout/ test.osm, I'm getting this error:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
Layer lines not found, and CreateLayer not supported by driver.

]
}

But the layer lines actually does exist: ogr2ogr -f GeoJSON /vsistdout/ test.osm lines

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "osm_id": "1", "name": null, "highway": "residential", "waterway": null, "aerialway": null, "barrier": null, "man_made": null, "z_order": 3, "other_tags": null }, "geometry": { "type": "LineString", "coordinates": [ [ 7.4592804, 51.4674372 ], [ 7.4594837, 51.4673888 ] ] } },
{ "type": "Feature", "properties": { "osm_id": "3", "name": null, "highway": "residential", "waterway": null, "aerialway": null, "barrier": null, "man_made": null, "z_order": 3, "other_tags": null }, "geometry": { "type": "LineString", "coordinates": [ [ 7.4597202, 51.4673325 ], [ 7.459888, 51.4672926 ] ] } }
]
}

Attachments (1)

test.osm (1.3 KB ) - added by tobwen 8 years ago.

Download all attachments as: .zip

Change History (4)

by tobwen, 8 years ago

Attachment: test.osm added

comment:1 by Even Rouault, 8 years ago

Resolution: invalid
Status: newclosed

This is a limitation of the GeoJSON driver. It supports only creating one "layer" (GeoJSON files don't have the concept of layer). So when you convert a multi-layer datasource like a OSM one, you need to explicitly specify which layer you want to put in it.

comment:2 by tobwen, 8 years ago

Then the error-message is wrong: Layer lines not found

comment:3 by Even Rouault, 8 years ago

Admitedly the error message is a bit cryptic. Should be improved with trunk r34074 "ogr2ogr: improve error message when CreateLayer() isn't supported (#6474)"

                      "Layer '%s' does not already exist in the output dataset, and "
                      "cannot be created by the output driver.",
Note: See TracTickets for help on using tickets.