2

Is there a way to extract only the nodes that connect links in OSM data? I am trying to locate US Interstate exit and entrance ramp ends in order to compare with my data. I've been able to extract end nodes but a lot of the ramps (motorway links) are a continuous line or single feature with only two ends connecting to the motorway while ignoring the secondary road. It seems that OSM data doesn't have shared nodes but instead stacks them at connection points. I'm going to look into extracting those but I am hoping there will be a more thorough way that will give me node attribute information if it's available.

Example is the highlighted motorway link below

enter image description here

EDIT:

I'm specifically looking for start and end node location of highway exit ramps (motorway_link) for all of US and Canada with the ability to differentiate between both start and end node. Here's an example of the nodes I need.

enter image description here

7
  • In that case, the OSM representation is that there is no connection point (maybe one on the right hand side at the bottom) - in logic terms it could just be an overpass / underpass without connection. Clearly the physical situation isn't like that, but it'll be guesswork to identify these situations if there is no node. Tagging might help a bit, but it probably won't be reliable.
    – BradHards
    Jul 27, 2017 at 4:10
  • 1
    There are shared nodes in OSM. A connection between two ways is defined as a node shared by both ways. Read OSM elements and OSM XML or just fire up an OSM editor and take a look at the actual data.
    – scai
    Jul 27, 2017 at 6:40
  • @BradHards There are nodes at the intersection it's just that they are stacked on top of each other not shared. (The black dots are direction arrows) Maybe that's more of an artifact of Qgis or shapefiles.
    – brink
    Jul 27, 2017 at 16:08
  • The nodes are actually shared in the OSM database, but any conversion to shapefile or other GIS formats converts them to line vertices that have the same coordinates.
    – AndreJ
    Jul 27, 2017 at 17:59
  • @scai I wasn't suggesting that there aren't shared nodes, but that sometime the ways just overlap.
    – BradHards
    Jul 27, 2017 at 22:26

1 Answer 1

3

You could try Overpass API to identify nodes where both highway=motorway and highway=motorway_link ways intersect. Here's an example:

[bbox:{{bbox}}];

way[highway=motorway];node(w)->.a;
way[highway=motorway_link];node(w)->.b;
node.a.b;
out;

Try it in overpass turbo! http://overpass-turbo.eu/s/qDZ

10
  • I assume the asker wanted the connection of the links with other road types. The connection with the motorway should always be start or end of a link.
    – AndreJ
    Jul 27, 2017 at 18:07
  • 2
    @AndreJ: you're probably right, overpass-turbo.eu/s/qE1 should get those intersections of motorway_link with non motorway/motorway_link ways. Could be adjusted as needed to also return the motorway_link again. Let's wait for the OP's feedback.
    – mmd
    Jul 27, 2017 at 18:19
  • @mmd I am focusing on only exit ramps not entrance. The first query works perfect for getting the start of the exit ramp but the second one brings up both exit and entrance connections to other road types. Is it possible to write a query that only pulls data for exit ramps? Two separate queries might be the best way since I need to differentiate between start and end nodes when comparing with my data.
    – brink
    Jul 28, 2017 at 23:14
  • I'm having a bit of a hard time to figure exactly what you're trying to achieve. What kind of data do you need for exit ramps? Preferably, can you add some example of actual osm data (way ids)? The following query will return the motorway_junction node, along with the first bit of the motorway_link: overpass-turbo.eu/s/qHC - if data is tagged correctly in OSM, that should in fact return exit ramps.
    – mmd
    Jul 30, 2017 at 10:11
  • @mmd That query is close. I need the start and end node of exit ramps only for the US and Canada, with the ability to differentiate between the two.
    – brink
    Jul 31, 2017 at 18:46

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.