Skip to content

Import OSM into PostGIS

nvkelso edited this page Jul 12, 2012 · 3 revisions

See also General PostGIS notes »

###Hardware

  • Buy more RAM.
  • Buy SSD drive.

###Software

  • Increase your swap space. Even as high as 8 or 16 GB would not be unreasonable. If you have filled your existing swap partition then it is easy to create one or more temporary swap files and add those. See mkswap and swapon man pages or ask Google.

  • If the DB is being written to an SSD then I suspect that the benefit of a large cache is reduced since the SSD has a very low IO latency. You could try making the cache smaller or even leaving it at the default 800MB.

###Notes

  • If you have other machines with more RAM available then it might be an idea to import the database on there and then pg_dump + restore on to another machine.

  • There are some tuning steps on the wiki but I guess you may have seen these already. I would not expect any of them to improve your memory problem.

  • http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS#Tuning_the_database

  • http://wiki.openstreetmap.org/wiki/Osm2pgsql/benchmarks

  • The last entry on the benchmark list shows that a recent planet file can be imported successfully on a machine with 16GB of RAM. Provided you add some more swap then it should complete successfully for you.

##Code

###Import OSM XML files

Clone this wiki locally