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

3
1

I want to write a web app, which needs to know the exact path of a certain road, e.g. the german Autobahn A7.
The minimum requirement for the data is a list of locations, forming a polyline, which approximates the road with an accuracy of 10 - 15 meters.

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

asked 25 May '12, 23:23

Gisela's gravatar image

Gisela
46112
accept rate: 0%

edited 26 May '12, 00:17


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 some cases you might have to do different searches to find the object you want and it will be too time consuming to run all that from within the browser
  • since these services don't reply with a complete geometry but instead with a series of nodes and ways, you'll have to parse and process that in the browser which might be time consuming as well
  • especially if you are "zoomed out", these services will return the full, detailed geometry of the object having tens of thousands of nodes and consisting of many parts, when it would be much easier for you to have an assembled and simplified geometry
  • if your application has more than the occasional visitor, you might be unduly placing load on the volunteer-operated XAPI/Overpass services.

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.

permanent link

answered 25 May '12, 23:38

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Yes, my plan is to use a server which will provide the path data (forgot to mention that, I've updated my question)
The simplified geometry from project-osrm.org sounds promising, I will check this.

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

  1. get information about the road, using a number of region searches, then
  2. dig deeper, using the results of the first queries the get more information
  3. filter out duplicate, and unnecessary data
  4. assemble my own Autobahn Object, and store it in my database, suitable for a web page

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
Your answer
toggle preview

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
×8

question asked: 25 May '12, 23:23

question was seen: 7,336 times

last updated: 26 May '12, 01:16

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