[OSM-talk] calling all python coders for slippy map help

Schuyler Erle schuyler at nocat.net
Thu Nov 16 02:22:26 GMT 2006


* On 15-Nov-2006 at  3:16PM PST, SteveC said:
> 
> We need help with the slippy map code. We need something that will do
> what this script does (or better):
> 
> http://wiki.openstreetmap.org/index.php/Slippy_Map#python_script
> 
> but not take an infinite amount of memory and do the entire planet.osm
> dump. Then we can generate tiles for everywhere.

Grab the two Python files from http://london.freemap.in/planet/. My
modifications of osm2sql.py use Evan Prodromou's lovely lrucache.py
from http://evan.prodromou.name/Software/Python/LRUCache to keep a
fixed maximum number of segments and nodes in memory, via a proxy
class that optionally uses BerkeleyDB to cache to disk, as well.

If you open up osm2sql.py, you'll see that you can configure 'useBDB'
and 'cacheSize'. With useBDB set to False (i.e. don't spend time
building the disk cache) and with cacheSize set to 100000, osm2sql.py
runs in a constant 50 megs of RAM on my 32-bit Debian x86 system.
Naturally, it runs slower than it would if infinite amounts of RAM
were available, and it would run slower still if I set useBDB to True.

The script is still running on my system, so I don't yet know what the
necessary or optimal values for these settings are, but I'm guessing
it will depend on the layout of planet.osm. I am fairly sure that the
script will run to completion with enough disk space and useBDB set to
True. I will drop another mail to the list when the run finishes and
we'll see if the disk cache turns out to be necessary. Similarly, if
you have lots of RAM to burn, you might try turning up cacheSize to
something larger -- the RAM usage should scale linearly.

Hope this helps!

SDE 




More information about the talk mailing list