4

I am very new to the map making world and I am trying to extract a body of water using OpenStreetMap, convert the XML file to a GeoJSON file so that I can upload it to Datawrapper.

This is the file I am interested in: https://www.openstreetmap.org/api/0.6/relation/13737936. I have saved this as the XML file and am trying to convert it to GeoJSON using https://tyrasd.github.io/osmtogeojson/. However, it returns an empty file such as

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

I have tried this on the command line as well and it returns the same thing. Why is this happening? I am not used to looking at XML files so I am not sure if there is anything wrong?

1 Answer 1

4

You need to add /full to the API URL like:

https://www.openstreetmap.org/api/0.6/relation/13737936/full

and copy that XML.

Gives:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "id": "relation/13737936",
            "properties": {
                "timestamp": "2022-01-31T04:54:48Z",
                "version": "3",
                "changeset": "116804664",
                "user": "DENelson83",
                "uid": "14512",
                "name": "ᐊᒃᓴᕐᓂᖅ Chesterfield Inlet",
                "name:en": "Chesterfield Inlet",
                "name:iu": "ᐊᒃᓴᕐᓂᖅ",
                "natural": "bay",
                "ocean": "yes",
                "ref:gnbc": "OADJR",
                "source": "NRCan-CanVec-10.0",
                "type": "multipolygon",
                "wikidata": "Q948291",
                "id": "relation/13737936"
            },
            "geometry": {
                "type": "Polygon",
                "coordinates": [
                    [
                        [
                            -92.57855,
                            63.79285
                        ],
                        [...
0

Your Answer

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

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