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

What's the best way to search for/geocode the intersection of two roads?

EDIT: I am asking for a user-facing tool, like MapQuest Open or Nominatim.

asked 01 Jan '14, 06:25

mattflaschen's gravatar image

accept rate: 0%

edited 01 Jan '14, 22:02

This should be possible using the Overpass API and the around keyword with a radius of 0. However I'm not skilled enough with the Overpass API to show you an example query. The maxheight map uses a similar mechanism and especially detects roads crossing each other without sharing nodes.

(01 Jan '14, 22:07) scai ♦

I'm not sure if it's the best way, but AFAIK a common solution is:

  • grab all way segments for road name A
  • grab all way segments for road named B
  • compare both list of nodes
  • return equal nodes

Please keep in mind, that this isn't robust against 'dirty' OSM tagging. Here roads can be splitted in very creative ways, intersections don't have to contain traffic lights (at the expected positions), ... In the end a appropriate solution depends on the requirements of your usecase.

permanent link

answered 01 Jan '14, 08:52

iii's gravatar image

accept rate: 10%

Er, would you care to elaborate about how to "compare both lists of nodes and return equal nodes"?

(01 Jan '14, 12:51) AlaskaDave

You generate a list of node IDs per way segment and add them to a collection per Road. After that you compare the ID collections and select that nodes that are in both road collections.

(01 Jan '14, 13:01) iii

@iii, thanks for your rapid reply, but I'm still in the dark. I'm not trying to be difficult but how do you generate those lists of node ids?

And for the comparison, do you simply eyeball the two lists or is there a way to do it computationally, e.g., put the lists into a spreadsheet, or whatever?

Can you try to be very specific?

(01 Jan '14, 13:09) AlaskaDave

iii is talking about a mechanical mechanism, i.e. a script or program. Of course you can do this all manually but it will take some time and is prone to errors.

(01 Jan '14, 15:09) scai ♦

The algorithm seems generally good (of course, elaborations and refinements would probably be helpful). However, I was asking from and end-user perspective. In other words, are there are any tools like MapQuest Open or Nominatim (the web interface) that do this?

(01 Jan '14, 22:02) mattflaschen

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 01 Jan '14, 06:25

question was seen: 8,177 times

last updated: 01 Jan '14, 22:09

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