[Overpass-api] How to find a random city?
I'm in a process of making a game based on OSM data. I will have the player starting in a random city.
I have something that is kinda working. It is not producing a result every time, it is slow, and possibly stressful for the server:
`(
node["place"~"village|town|city"]
`node["place"~"village|town|city"]
(around: 100000, -32.95044811908156,23.325451081618667);
);
-32.950,23.325);
out 1;`
I am generating a random coordinates and search for any node with `place=village|town|city` tag within 100 km. The problem is that some of the random coordinates appear in the ocean or in deserts where there are no cities in that radius. I tried increasing it, but the query is getting even slower (expected) and I'm not sure if it is not bad for the Overpass server.
Can you see any way to improve this query? Can you suggest entirely different method of finding a random city?