This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Get all motorway_junciton including the roadname

0

Hello,

I would like to get all motorway junctions with their roadnames. At the moment, I'm using this:

[timeout:3600][maxsize:1073741824][bbox:{{bbox}}];
way[highway~"^(motorway)$"];
node(w)[highway=motorway_junction];
(._;>;);
out meta;

Which works, but it gives me the following output:

{
  "type": "Feature",
  "properties": {
    "@id": "node/9200769",
    "highway": "motorway_junction",
    "name": "Kreuz Rostock",
    "ref": "9",
    "@timestamp": "2015-04-09T06:46:01Z",
    "@version": "10",
    "@changeset": "30082198",
    "@user": "da-sch",
    "@uid": "200139"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      12.1994746,
      54.0327681
    ]
  },
  "id": "node/9200769"

I can't find any information, which says, on which road this junciton is. I do not mean the destination road. In my example it would be the road(highway) "A20". For testing i'm using overpass turbo.

Could somebody please help me?

asked 28 Aug '17, 12:22

_supersonic's gravatar image

_supersonic
11112
accept rate: 0%

Are you asking about the data model, or about the overpass syntax?

As to data model, "A 20" is the value of the destination:ref=* tag on the highway=motorway_link road that node 9200769 is part of. I don't know the overpass syntax for requesting that information.

(28 Aug '17, 12:55) dsh4

One Answer:

1

The node(w) here means you are only fetching motorway_junction nodes that are part of a highway=motorway (or motorway_link; this is subtlety different than all motorway_junction nodes).

way[highway~"^(motorway)$"];
node(w)[highway=motorway_junction];

I think there is no way to get Overpass to amend the nodes with information from the parent ways, but you can at least return the ways as part of your Overpass query and then use the node ids to find information about parent ways:

[timeout:3600][maxsize:1073741824][bbox:{{bbox}}];
(
way[highway~"^(motorway)$"];
node(w)[highway=motorway_junction];
);
out meta;

Overpass Turbo might warn that this query is broken because it doesn't return the full geometries of the ways, but if I understand correctly you don't care about the way geometry, so just ignore the warning.

answered 28 Aug '17, 13:57

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Source code available on GitHub .