tyrasd/osmtogeojson

can't convert OSM ways data to geoJSON

baoqger opened this issue ยท 4 comments

I send the following request to Overpass API:
http://overpass-api.de/api/interpreter?data=[out:json];way(50.7460,7.170,50.7461,7.171);out;
and get the following OSM data in JSON format:

{
    "version": 0.6,
    "generator": "Overpass API 0.7.55.4 3079d8ea",
    "osm3s": {
        "timestamp_osm_base": "2018-11-05T11:34:02Z",
        "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
    },
    "elements": [
        {
            "type": "way",
            "id": 24865000,
            "nodes": [
                280980668,
                1741079114,
                334391472,
                270190123,
                1741085124,
                1741085123,
                270190139,
                1074119045,
                1572443866,
                100793191
            ],
            "tags": {
                "highway": "residential",
                "lit": "yes",
                "name": "In den Bieshecken"
            }
        },
        {
            "type": "way",
            "id": 25763531,
            "nodes": [
                100793192,
                280980654,
                100793191,
                100793190
            ],
            "tags": {
                "highway": "residential",
                "lit": "yes",
                "maxspeed": "30",
                "name": "Am Tiergarten"
            }
        },
        {
            "type": "way",
            "id": 25763532,
            "nodes": [
                100793191,
                1074118994,
                280980655,
                280980656,
                280980657
            ],
            "tags": {
                "highway": "residential",
                "lit": "yes",
                "name": "An Tiebes Eiche"
            }
        },
        {
            "type": "way",
            "id": 92528384,
            "nodes": [
                3256465633,
                3256519347,
                3256519346,
                3256465632,
                3256465633
            ],
            "tags": {
                "addr:city": "Bonn",
                "addr:country": "DE",
                "addr:housenumber": "7",
                "addr:postcode": "53229",
                "addr:street": "Am Tiergarten",
                "building": "residential",
                "building:levels": "2",
                "source:outline": "ALK NRW"
            }
        },
        {
            "type": "way",
            "id": 92528389,
            "nodes": [
                3256465636,
                3256519354,
                3256465631,
                3256465630,
                3256465634,
                3256519352,
                3256465636
            ],
            "tags": {
                "addr:city": "Bonn",
                "addr:country": "DE",
                "addr:housenumber": "6",
                "addr:postcode": "53229",
                "addr:street": "Am Tiergarten",
                "building": "residential",
                "building:levels": "2",
                "number_of_apartments": "1",
                "roof:levels": "2",
                "source:outline": "ALK NRW"
            }
        }
    ]
}

And then the npm osmtogeojson package failed to output the featurecollection, instead, I only get an empty list as following:

{
    "type": "FeatureCollection",
    "features": []
}

So what's the problem here? My usage is wrong or the tool miss this function?

I'm not a developer on the project, but the usage should be .osm (xml) file as input, and .geojson as output. If you input a .geojson, then I expect an empty output like you show.

Not really sure but having the same problem, it seems that if there is no node element with the way, conversion will not work.

Specifying out geom; for the output appears to help.

Use [out:xml] not [out:json] in Overpass - your input is in wrong format (and no, it is not Geojson either)