Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9249313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:09:31+00:00 2026-06-18T10:09:31+00:00

I am looking for a way to retrieve street intersections accurately from OpenStreetMap (OSM)

  • 0

I am looking for a way to retrieve street intersections accurately from OpenStreetMap (OSM) data. I am aware that similar questions were asked and answered, but the data I could retrieve from the suggested method is not very accurate.

First of all, I am aware of following questions:

  • how to find intersections from OpenStreetMap?
  • Detection of Intersections in the maps

The answers to the aforementioned questions suggest to:

“Query all ways in a given bounding box and look for nodes shared by two or more ways as explained in the other answer.”

I followed this suggestion and wrote a python script that extracts node elements from an xml file (osm file) that I downloaded from OpenStreetMap. Following is the code:

try:
    from xml.etree import cElementTree as ET
except ImportError, e:
    from xml.etree import ElementTree as ET

def extract_intersections(osm, verbose=True):
    # This function takes an osm file as an input. It then goes through each xml 
    # element and searches for nodes that are shared by two or more ways.
    # Parameter:
    # - osm: An xml file that contains OpenStreetMap's map information
    # - verbose: If true, print some outputs to terminal.
    # 
    # Ex) extract_intersections('WashingtonDC.osm')
    #
    tree = ET.parse(osm)
    root = tree.getroot()
    counter = {}
    for child in root:
        if child.tag == 'way':
            for item in child:
                if item.tag == 'nd':
                    nd_ref = item.attrib['ref']
                    if not nd_ref in counter:
                        counter[nd_ref] = 0
                    counter[nd_ref] += 1

    # Find nodes that are shared with more than one way, which
    # might correspond to intersections
    intersections = filter(lambda x: counter[x] > 1,  counter)

    # Extract intersection coordinates
    # You can plot the result using this url.
    # http://www.darrinward.com/lat-long/
    intersection_coordinates = []
    for child in root:
        if child.tag == 'node' and child.attrib['id'] in intersections:
            coordinate = child.attrib['lat'] + ',' + child.attrib['lon']
            if verbose:
                print coordinate
            intersection_coordinates.append(coordinate)

    return intersection_coordinates

If I run this code with the data I exported from OSM (e.g., I used data exported from Area of Export: Min Lat: 38.89239, Max Lat: 38.89981, Min Lon: -77.03212, and Max Lon: -77.02119.), it prints out coordinates that look like:

38.8966440,-77.0259810
38.8973430,-77.0280900
38.9010391,-77.0270309
38.8961050,-77.0319620
...

If I plot these coordinates on Google Maps, it looks like:
enter image description here

(I used http://www.darrinward.com/lat-long/ to plot data.) Apparently the data contains some nodes that are not intersections (they are probably stores that are facing towards two steets.)

Am I doing something wrong or is this the best “intersection” data I can get from OSM? I appreciate your help and comments.

Best,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:09:32+00:00Added an answer on June 18, 2026 at 10:09 am

    First Tipp:

    Do not only compare with Google Maps, compare your coordinates mainly with OpenStreetMap visualisation. Especially complex street crossings, although they represent the same road, can be different modelled.

    2): Look if you really using the right type of ways: Are that foot paths, mixed with streets? There are various different types, with differnet attributes: accessible for vehicles, etc. In Google MAps, the white roads are that one that are accessible by vehicles

    3) Further look, if you dont get house polygons mixed in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a way to retrieve the style from an element that
Looking for a way to retrieve a file size from a web server using
I'm looking for a way to retrieve a collection of DTOs from my WCF
I am looking for some advice on the best way to retrieve information from
I am looking for a way how to retrieve archive of chat messages from
What is the easiest way to retrieve a bean id from inside that bean
I'm looking for a way to retrieve the #anchor part from the current URL
I am looking for a way to retrieve the certificate chain of a targeted
I am looking for a way to retrieve the surrounding rows in a NHibernate
I am looking for a way to retrieve the variable name, so I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.