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
150●11●11●18
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?
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.
How to convert this json representation to plain geojson?