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

2
1

Hello all

I am trying to write a program in c++ to automatically detect the roads on a selected area of the map. I was able to do detect the roads from the Ways and tags attached to them. But I could not find any specific tag that is related to an intersection between two roads. Only thing close to is a traffic signal tag. I was wondering if any one know more authentic way to determine the intersections. Hope my question was not ambiguous.

asked 23 Aug '12, 13:56

jawadch's gravatar image

jawadch
1214412
accept rate: 0%

edited 23 Aug '12, 13:57


In the OSM XML for a way, you'll see data such as:

  <nd ref="322896584"/>

That indicates a node that is part of your way. If that exists in two ways, those ways join.

permanent link

answered 23 Aug '12, 14:00

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

I checked it and it is true for the case in which two streets are intersecting. But is it also true for the case when on street e.g. a residential is ending in a main street?

(23 Aug '12, 14:03) jawadch
1

Yes, it should be. If not, someone hasn't joined the roads properly, as described here.

(23 Aug '12, 14:05) SomeoneElse ♦

Thanks a lot. I should be able to detect it now.

(23 Aug '12, 14:08) jawadch

If one way street is going from south to north(longitude will be increasing) will the node references in the Way of that street will be such that the longitude of the first node ref is minimum and the longitude of the last node ref will be max. In short are the node ref in Way of "one way" roads along the direction of that road?

(23 Aug '12, 14:52) jawadch
2

Yes - here's a stretch of oneway road (it has the tag "oneway=yes" and runs from south to north). The first node is at the south end and the end node is at the north end. As you can see, the references of the nodes may vary (later nodes have higher reference numbers) but the order of nodes in the way will be in the order that they appear on the ground.

(23 Aug '12, 15:09) SomeoneElse ♦

Thanks a lot again :)

(23 Aug '12, 15:23) jawadch
3

As an addidtion to the oneway issue, there are also other tags (although not much used). oneway=-1 means the nodes are ordered in opposite direction (when the way goes from S to N, the nodes are oredered from N to S)

And some discouraged alternatives like "true" and "reversed" instead of "yes" and "-1": http://wiki.openstreetmap.org/wiki/Oneway

(23 Aug '12, 16:29) Sanderd17

I have extracted the intersections that I need, my question is how to detect each twe adjacent intersection so I can define an adge to connect them and create a connected graph of inresection nodes. Thank you in advance for helps

(10 Apr '14, 12:45) Angeasg
showing 5 of 8 show 3 more comments

I have extracted the intersections that I need, my question is how to detect each twe adjacent intersection so I can define an adge to connect them and create a connected graph of inresection nodes. Thank you in advance for helps

permanent link
This answer is marked "community wiki".

answered 10 Apr '14, 12:45

Angeasg's gravatar image

Angeasg
11112
accept rate: 0%

You might do better asking a new question describing what you're trying to do rather than asking a new question in an answer to an old one :)

(10 Apr '14, 13:08) SomeoneElse ♦

Hi,, can y send me the code ? I need to do the same and return the name os intersection, but I dont know how.. Tanks..

permanent link

answered 27 Jun '17, 13:19

mneto's gravatar image

mneto
111
accept rate: 0%

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

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

×223
×191
×49

question asked: 23 Aug '12, 13:56

question was seen: 17,089 times

last updated: 27 Jun '17, 13:19

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