I want to write a web app, which needs to know the exact path of a certain road, e.g. the german Autobahn A7. Optionally extra data like junctions, exits, tunnels, bridges and road km would be fine. Altitude would be great. So, the questions are:
What would the query look like? Addition: it is not required that the data is queried live from the app - it would be perfectly ok that the query is done beforehand and formatted and stored in a database |
It is possible, but only if you set up a suitable server yourself. You will want to import data into a PostGIS database e.g. with imposm or osm2pgsql, and then write some code (e.g. in PHP or another scripting language) that lets the client request something and it replies with a geometry. The existing services - most notably Overpass API but also the XAPI instances you mentioned - will be able to answer simple queries like "give me all objects have ref=A7 in this bounding box" or "give me all members of a route relation called ref=A7", and this might be sufficient to build a prototype, but you won't be able to build a proper application with that for a number of reasons:
In addition to what has already been discussed, there's also the routing engine at project-osrm.org which already has some neat features e.g. producing a simplified geometry, but with that engine you can only acces the fastest route between to points and not something arbitrary like "Autobahn x" or so. Yes, my plan is to use a server which will provide the path data (forgot to mention that, I've updated my question) I just wonder: road information seems to me a very basic part of a project called OpenStreetMap; the information I want is very fundamental for the map rendering and for navigation applications - so why it is a non trivial task to get this kind of data? If I get it right, using the services mentioned I have to
This is quite a bit.
(26 May '12, 00:17)
Gisela
The information you want is there in the database, but the database is not organised in a way that would easily serve your particular query. That's why you have to do this organising yourself. Everyone who does rendering or navigation will pre-process OSM data into the strucuture that best serves the use case. If you are interested in a "I think OSM should be offering X" type of discussion, then the talk mailinglist would be a good place for that.
(26 May '12, 00:58)
Frederik Ramm ♦
Thank you for your answers and the insights, I know that I have to go deeper into the docs - and surely will (it's my first day here).
(26 May '12, 01:16)
Gisela
|