Given a square area, what is the best way to find the approximate coordinates of every street intersection within the given area ?
-
It can be done in a number of ways, but what have you tried so far? – Marcelo Sep 13 '12 at 08:27
-
One that I'm going to see how it works is to determine all the street names in the area by sampling the area and then determine all their intersections. – Radu Stoenescu Sep 13 '12 at 09:22
2 Answers
Since there is no description of your application, I can't tell if you need to use Google Maps or if another data source would answer your needs. If http://openstreetmap.org fulfills the requirements of your application, then it's easy:
- the OSM API has a request to pull data from a rectangular region. You get XML data.
- filter this data to keep only the street you are interested in, probably the "key=highway" tags
- filter this to keep only the points belonging to two or more lines.
Please disregard this if Google Maps is a requirement.
But still: since the roads exist independently of the database, the above method will yield roads intersections (in lat/long coordinates) with a pretty high correlation with what you would get from Google maps ;-) You can then use those points to display them over a Google map, knowing that both datasets aren't identical so it won't be perfect.

- 4,315
- 4
- 27
- 43
-
Ok, I have downloaded the XML file of the rectangular region. How Exactly do i create a filter to keep only the points belonging to two or more lines? I mean, how do I even start? Which tool do you recommend I use? – SteBra Sep 01 '16 at 13:11
-
Might not be the easiest method but I used a seperate database of our countries roads with their linestrings. I took the first and last points of each line string, then counted the number of roads within 50 m of each start/end point. I then took the nodes from navigation route and used these to compare the number of roads intersecting with each node. I then looked at the direction each start point and the next point along that road, which gives you direction. from that with a bit of maths you can work out the number and angle of the roads at the next intersection. I then made a road rules application that tells you which vehicles to give way to

- 169
- 1
- 1
- 9
-
3It would be helpful if you added psuedo code. The verbal description is not easy to read. – Guy Coder Sep 16 '12 at 20:20