I want to implement an A* Search Algorithm with OSM, but how can I get the coordinates just from the streets, not from the houses etc? And how can I get the neighbor's coordinates from this specific street coordinate? How can I identify crossroads? Does someone have an idea? I need this to trace a route, but using my own algorithm *Coordinates= Latitude,Longitude asked 21 Jul '13, 03:02 user |
You need to read up on the basics of the OSM data model, e.g. on the Wiki. This will give you an idea of how to identify what is a street. You will then be able to process an OSM data set and export streets only, or identify crossroads. Finding neighbour's coordinates is a simple geometric problem. Many people will have "an idea" about this but the space here is too short to explain it all! It is possible that importing OSM data into a spatial database (e.g. imposm, osm2pgsql - read other answers about these in this help system) will help you, since you can then query the database for geometries or things like nearest neighbours. answered 21 Jul '13, 17:13 Frederik Ramm ♦ how can I get the neighbor's coordinates from a specific street coordinate?
(22 Jul '13, 18:20)
user
I have to download the spatial database? I can't do this using HTTP request?
(23 Jul '13, 03:58)
user
3
To do anything directly with the OSM data (such as routing) you'll almost certainly want to download an extract of the data (such as from one of the links here) first.
(23 Jul '13, 09:55)
SomeoneElse ♦
2
You have to download the data and prepare it in a suitable fashion. You cannot use an API for what you want to do because you need access to much more data than you can download from the API, and your algorithm would be terribly slow. Getting the neighbour's coordinate is a geometric problem that e.g. a PostGIS database would solve for you (search the web for "nearest point postgis" or so).
(23 Jul '13, 09:59)
Frederik Ramm ♦
ok, I'm using PostGis with Osm2pgsql schema now, but it's not the nearest point, I need of all points around. look this image Here, the green square is my current location and the red square is the destination, so, How can I represent these squares on osm2pgsql schema? line, point, polygon or roads? and the main question is: how to get the squares around of my current location?
(25 Jul '13, 04:57)
user
|