Hi, I greatly need your explanation. I am working on a project and i am to identify all the roads in a particular area. For each of the roads, i'm to identify and list out all the intersections in order. I donot really know how go about this. Please can somebody give me an explanation? Thanks asked 26 Jan '22, 20:37 Segunlakata |
This will require some amount of programming. There isn't a web service that does this work for you. First you must understand that roads can be split into many segments in OSM. The geometry of a street in OSM is represented by nodes with coordinates. Where two streets intersect, they will share the same node. Hence, one possible approach is:
Other possible approaches, if you are more comfortable with that, include loading the data into PostGIS and doing everything with SQL commands. answered 27 Jan '22, 08:28 Frederik Ramm ♦ Thank you for your response @Frederik Ramm. Your feedback has been very helpful. Can you please re-explain this your statement..."then combine ways into clusters that have the same street name and where one way ends with the same node the other way begins with, so that you end up with just one way for every street instead of potentially several". I am confused. Should I combine all the ways (e.g. highway) irrespective of the street name as one way should I group the the ways based on the street names? What I did is this. I combined "ways" with the same street name as one way. I then Iterated through the way for a repeated node id, which i assume should be the intersections. I got some results. But while testing the coordinates directly, some of the coordinates were not pointing to intersections on the OpenStreetMap. Is there anything I'm missing? Thanks
(31 Jan '22, 15:01)
Segunlakata
Yes, using the name as a grouping feature was a good idea. -- Is it possible that you have somehow retained the duplicate nodes that occur where one segment of a street ends and another of the same street begins? Those could be anywhere, not just at intersections, are they maybe responsible?
(31 Jan '22, 18:52)
Frederik Ramm ♦
Expanding on Frederik's comment, perhaps you have misunderstood the meaning of the segments (ways) that make up a single named street? They do not (in general) correspond to segments between intersections. A street may be split into multiple ways in the data wherever any mapped property of the street changes: the number of lanes, the presence or absence of sidewalks, and so on. Sometimes these coincide with intersections, but often they don't.
(31 Jan '22, 19:50)
alan_gr
|