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

We're programming an app for Windows Phone 7, and we're using Open Street Map (OSM) as our data source.

We're using this URI: http://api.openstreetmap.org/api/0.6/map?bbox=32.0846,034.8415,32.3846,035 and we're filling in coordinates according to the current position of the app's user.

The data we receive is : "nodes", "way", and "relation".

There are a few things we don't understand:

  • In the OSM database, the "way"s have references to nodes (which appear in the database as "nodes"). The "relation"s have references to "way"s. However, quite a few times, we couldn't find the the "way" which was referenced to, in the database. Why don't they all appear?

  • In order to extract data about bicycle routes from the OSM by coordinates, which part of the database is the app supposed to check first? The relations, and through them we'd get to the ways and the nodes, or is there a different way...?

Thanks :)

asked 27 Aug '13, 14:24

yehudit's gravatar image

yehudit
61667
accept rate: 0%

edited 27 Aug '13, 20:56

MagicFab's gravatar image

MagicFab
935101622


All ways should exist in the database. You can check this by going to http://www.openstreetmap.org/browse/way/123456 (or whatever the way id is). If nothing is returned this is a database error, but this is exceptionally unlikely.

The easiest way to get linestrings (i.e. linear lists of co-ordinates) from relations is indeed to get the relation; then get the member ways; then get the member nodes from each way. However, note that relations are not necessarily ordered: the ways may be in random order. If you want to create an ordered linestring, you will need to look for start/end points of the ways that coincide.

Please remember that the 'API' you are using is an editing API only. It exists solely for programs that are principally designed to allow users to edit the map. If your app is not an editor, you should download the data and host it on your own servers. You can download the data from planet.openstreetmap.org (note the links to extracts on the right-hand side of the page, which you will find much more malleable than the full dump). You may want to consider the programs 'Osmosis' and 'osm2pgsql' for details on how to work with this data, or you may be confident in working directly with the XML yourself.

Finally, I would really strongly recommend you read http://wiki.openstreetmap.org/wiki/Elements to get an understanding of the basic OSM data structure. This help site can offer advice, but contributors' patience is not infinite and we can't really explain the basics of OSM to everyone who comes here.

permanent link

answered 27 Aug '13, 15:12

Richard's gravatar image

Richard ♦
30.9k44279412
accept rate: 18%

Thanks Richard. I apologize for asking about the "basics of OSM", but I spend quite some time on the web before asking a question. Anyway, the problem still stands: I've got ways that don't belong to a relation, and ways inside the relations, that don't exist themselves. I'm currently downloading the file from "planet" but it weighs 30 GB and I doubt such a big file would be very handy for an app... any other ideas? Thanks again.

(29 Aug '13, 13:39) yehudit
1

You can still query the API directly for individual node/way/relation IDs. But remember that this is slow and not recommended for bulk queries.

(29 Aug '13, 13:41) scai ♦

Yeah, but I'm talking about nodes/ways/relations that simply don't seeem to exist

(29 Aug '13, 13:48) yehudit
2

By "don't exist" I presume you mean "don't exist in the data that you've retrieved from your API "map" call. Can you give an example (of the bbox for the "map" call, the relation that you get back and the way that's not returned by the "map" call)?

(29 Aug '13, 14:02) SomeoneElse ♦

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:

×236
×113
×6

question asked: 27 Aug '13, 14:24

question was seen: 3,052 times

last updated: 29 Aug '13, 14:02

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