Hello.
I wanted to process the entire world with a query of the type:
[out:json][timeout:300];
area["ISO3166-1"="DE"][boundary=administrative]->.germany;
(
node(area.germany)["man_made"="works"];
way(area.germany)["man_made"="works"];
relation(area.germany)["man_made"="works"];
node(area.germany)["industrial"];
way(area.germany)["industrial"];
relation(area.germany)["industrial"];
node(area.germany)["man_made"="works"]["product"];
way(area.germany)["man_made"="works"]["product"];
relation(area.germany)["man_made"="works"]["product"];
);
out center;
(._;>;);
out skel;
Of course, I did the responsible thing and downloaded the entire dataset from OSM. What I find odd is that the following Python code takes a very long time (now running for 4 hours and is roughly 20% done, assuming OSM has 8 billion nodes):
class IndustrialHandler(osmium.SimpleHandler):
def __init__(self):
super(IndustrialHandler, self).__init__()
self.elements = []
def node(self, n):
if 'industrial' in n.tags or ('man_made' in n.tags and n.tags['man_made'] == 'works'):
self.elements.append({
"id": n.id,
"type": "node",
"lat": n.location.lat,
"lon": n.location.lon,
"tags": n.tags
})
Is there anything I am doing wrong? For reference, the above query with Overpass took 1 minute. I am not very experienced with osmium and would be grateful for tips.