[OSM-dev] Best way to select from a region

Roland Olbricht roland.olbricht at gmx.de
Wed Sep 2 17:14:44 BST 2009

> > http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script
> that sounds cool. Did not know it before. It's not advertised a lot ;)
> What are the limits? Frederik mentioned a query against a polygon might
> be slow. Which area could be returned? Only a city? Bavaria? France?

The query against a polygon is in general not very expensive. Retrieving a 
single polygon takes a single hard disk hit, and the computational effort can 
be neglected against that.

The limiting factor is the RAM size of the server (4 GB). To avoid 
congestions, I've set a weighted limit of 10'000'000 elements so far (this 
takes about 500 MB of RAM to process the data, so four queries and the update 
process could safely run in parallel) - think of roughly 5'000'000 nodes. The 
amount of RAM is needed to sort the nodes, ways and relations in ascending 
order of their ids.

Bavaria would be a corner case and is worth a try ... It doesn't work, it has 
already over 10 million nodes.

> Or maybe only query the nodes near the border against the expensive
> polygon?

Whatever system you use, it will probably automatically use less a expensive 
query deep inside a polygon.



More information about the dev mailing list