[openstreetmap-website] Create a rake task for populating the database (#282)

danstowell notifications at github.com
Thu Sep 19 07:40:03 UTC 2013


I only need to import data. (I need fairly rich data, so drawing a few ways myself isn't quite enough for me.)

Just for the record (for anyone drafting a rake task!), here's what I've done which seems to have given me a usable read copy of the apidb:

* Of course I had first done the database setup described in INSTALL.md, so I already had the databases and the postgres user set up.
* Ensure the database is empty (so that the import doesn't clash on IDs):
                 `osmosis --truncate-apidb host="localhost" database="openstreetmap" user="openstreetmap" password="" validateSchemaVersion="no"`
* Load the dump into the db (for Greater London, this took about 20 minutes on my laptop):
                ```osmosis --read-pbf file=greater-london-latest.osm.pbf --write-apidb host="localhost" database="openstreetmap" user="openstreetmap" password="" validateSchemaVersion="no"```
* Optional step: postgres tools to reclaim disk space:
                 ```sudo -u postgres vacuumdb -afvz```
                 ```sudo -u postgres reindexdb```

This does *not* reset the sequences, as mentioned above in this thread. However it doesn't seem to need any weird privileges in the postgres user accounts. But then, since I don't know the database internals I don't know if the sequences issue is the only quirk of the (development) database I've landed myself with.

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/282#issuecomment-24721913
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20130919/fddec29e/attachment.html>


More information about the rails-dev mailing list