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:
Thanks :) |
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. answered 27 Aug '13, 15:12 Richard ♦ 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 ♦
|