When trying to run TileMill with OSM Bright all I get is a "code 3" error, which apparently stands for "out of memory" error.

I'm trying to work on France, but I could restrict the work on one region at a time if it helped with memory.

The PostGIS db runs in a VirtualBox machine running Debian.

My PC is an Intel i5 with 4GB of RAM.

Should I:

  • buy a new machine (I'd rather not)?
  • rent something on AWS?
  • run in a non-interactive way?

Or is there a commercial alternative to TileMill that's more efficient? Any other idea?

  • How much RAM and SWAP has your guest? – scai Feb 21 '14 at 7:28
  • Rather than buying a new machine, can your current one accept additional memory? – Chad Hawkins Feb 21 '14 at 11:38
  • Here's what I did: I dual-booted to Debian AMD64 (Wheezy) and put 8Gb of memory. Installing TileMill on Debian was a big pain but osm2psql was much much faster this way (8 hours instead of 35). It now seems to be working but it's quite slow (it could really use a progress bar!) – Bambax Mar 6 '14 at 9:14
  • 8Gb memory: I meant I bought 8Gb and therefore now have 12Gb. It would appear the bottleneck is now the CPU (top indicates 99% for postgresql and at times over 200% for tilemill (??)). – Bambax Mar 6 '14 at 14:21

I would have thought that 4GB of RAM should be sufficient. It is possible that TileMill has a memory leak. It certainly used to a while back, but I'd have assumed they'd have fixed that by now. Since TileMill is based on node.js it maybe is suffering from a limit on the heap size and you might be able to adjust that, but I'm no expert in that, so here are some alternative suggestions:

TileMill uses Mapnik for rendering, so you could use Mapnik directly in C++ or through the Python bindings and thereby cut out TileMill altogether. You can then use Python's multiprocessing (not it's multithreading - that won't help because of the GIL) and hive off each tile rendering process into a subprocess which will close on completion and thereby help your speed and memory issues (hopefully). Style definitions in TileMill and Mapnik are a little different in syntax so here's a link to the OSM Standard Mapnik Style.

Another alternative that should be very simple to implement could be to set up GeoServer with appropriate SLDs for your OSM data and then tell Geoserver to seed its tile cache.

  • Thank you for this answer; although Tilemill + postgresql osm db now work (on Debian with 8Gb, cf. above comment), using GeoServer sounds interesting. Is there a thorough tutorial on how to set this up? I found this blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap which is interesting but doesn't explain the steps in detail... – Bambax Mar 6 '14 at 9:13

France is one of the larger OSM datasets that exists, thanks to France's community and a French building import.

If you're in the map design phase and extensively using Tilemill to try different map styles, using a much smaller extract of a small region of France would be much more efficient.

In any case, I doubt you would be able to export your project from tilemill with that limited setup. I would definitely change to a different server.

  • Your suggestion to restrict rendering to a small region of France makes a lot of sense (I'm not working on the whole country at the same time); and indeed there is an option in configure.py for osm-bright that lets one do just that (config["postgis"]["extent"]). However, the units are "spherical mercator meters" and I'm not sure how to translate from WGS84 to those, or determine them directly from a selection on the map...? – Bambax Mar 6 '14 at 9:00
  • WGS84 to spherical mercator meters: there's a conversion script here that does exactly that (and more!) maptiler.org/google-maps-coordinates-tile-bounds-projection – Bambax Mar 6 '14 at 9:49
  • Limiting to a region with onfig["postgis"]["extent"] changed everything! ;-) – Bambax Mar 6 '14 at 14:23
  • Sorry... for GIS dummies... can you tell me what config["postgis"]["extent"] does? I am also having troubles with TileMill performance and like to increase it while designing my map... – Georg Jun 23 '14 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.