NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I would like to export the Nordlink power cable relation to GeoJSON.

Until now I'm using the API with python-overpass and the following query:

relation(5500685);(._;>;);out geom;

As output I'm getting the LineString two times (!) plus all points. Example:

{
  "geometry": {
    "coordinates": [
      6.5962545,
      58.181566
    ],
    "type": "Point"
  },

While when using the Overpass API manually (Link)

[out:json][timeout:300];
(
relation(5500685);
);
out body;
>;
out skel qt;

I only get the LineString:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "@id": "way/370147304",
        "@relations": [
          {
            "role": "",
            "rel": 5500685,
            "reltags": {
              "type": "collection",
              "wikidata": "Q1961296",
              "wikipedia": "no:NordLink"
            }
          }
        ]
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            6.6807119,
            58.2607599
          ],
          [
            6.694153,
            58.2131834
          ],
          [
            6.6534177,
            58.1893486
          ],
          [
            6.5962545,
            58.181566
          ],
          [
            6.4788896,
            58.1497393
          ],
          [
            6.4419395,
            58.0867718
          ],
          [
            8.4853879,
            54.2985972
          ],
          [
            8.7676507,
            54.179769
          ]
        ]
      },
      "id": "way/370147304"
    }
  ]
}

How can I get the same result (without points) like the manual query by using the API?

asked 24 Apr '18, 09:36

Druzhba's gravatar image

Druzhba
150111118
accept rate: 0%

The two queries you mention here are different, so it's logical that you'd get different results. Have you tried simply using the same query?

(24 Apr '18, 16:53) alester

Note that Overpass-API doesn't output geojson, it outputs a json representation of the osm node/way/relation data model. Overpass Turbo has some code that converts the osm data model to geojson.

(24 Apr '18, 20:15) maxerickson

How to convert this json representation to plain geojson?

(24 Apr '18, 21:45) Druzhba

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×85
×78
×36

question asked: 24 Apr '18, 09:36

question was seen: 2,711 times

last updated: 24 Apr '18, 21:45

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum