I'm testing a script using PyOsmium on I have printed the whole tag list of elements I could definitely find on the map, such as New South Wales, which has an Furthermore, the website clearly knows where to center the view, so it has access to the coordinates of New South Wales, but I can't find them on any tag: where am I supposed to look for them? The files I'm using are downloaded directly from this page (Latest Weekly Planet PBF File), so I don't think any data is missing. Could it be a bug in PyOsmium? asked 27 Jul '21, 11:22 fsaler |
You are likely having an issue with indirection. It sounds like you might have made the assumption that there must be nodes for everything of interest? The fact that some interesting objects have a node describing them might have led you astray. NSW is a relation (https://www.openstreetmap.org/relation/2316593) which consists of around 700 ways (https://www.openstreetmap.org/way/623279971 being one) and these ways then again have nodes (https://www.openstreetmap.org/node/5886081754 being one of thousands of nodes making up the outline of NSW). So, what you have to do is: find relations (or sometimes ways) that have the tags you are interested in; construct their geometry by digging down into the member ways/nodes; then (if a single lat/lon is what you're after) construct a centre point of the resulting geometry. Pyosmium can aid you in doing all this - but have you made use of that? answered 27 Jul '21, 11:47 Frederik Ramm ♦ Yes, I am using PyOsmium. The issue is that I will have to do this for pretty much every single town of the planet, and constructing a centre from many related nodes of each node (or relation) sounds really expensive. Is there no way to get an approximate point more quickly? I don't need it to be precise.
(27 Jul '21, 11:57)
fsaler
Apparently the
(27 Jul '21, 12:05)
fsaler
|