Size: 1899
Comment:
|
Size: 1592
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 7: | Line 7: |
== Converting OSM to PostGIS == | == Importing OSM to PostGIS == |
Line 10: | Line 10: |
---- /!\ '''Edit conflict - other version:''' ---- To import planet.osm, we use {{{osm2pgsql}}}. Several things have to considered to import planet.osm without running out of memory or time. The following command is used to import {{planet.osm}}: ---- /!\ '''Edit conflict - your version:''' ---- |
|
Line 18: | Line 12: |
The following command is used to import {{{planet.osm}}}: ---- /!\ '''End of edit conflict''' ---- |
The import {{{planet.osm.pbf}}} on atlantis, run this command as user {{{postgres}}}: |
Line 30: | Line 22: |
{{{-d]}} specifies the database to use | {{{-d}}} specifies the database to use |
Line 32: | Line 24: |
{{{--slim}}} will take much longer, but externalizes some stuff to the disk and to the database itself. Without {{--slim}, you will quickly run out of RAM. | {{{--slim}}} will take much longer, but externalizes some stuff to the disk and to the database itself. Without {{{--slim}}}, you will quickly run out of RAM on atlantis. |
For testing purposes we set up up a PostGIS server containing planet.osm.
PostGIS Server
The server runs on atlantis, a pgAdmin frontend is running at http://atlantis.informatik.privat/pgadmin4/. The OSM data is in database osm.
Importing OSM to PostGIS
To import planet.osm, we use osm2pgsql. Several things have to considered to import planet.osm without running out of memory or time.
The import planet.osm.pbf on atlantis, run this command as user postgres:
osm2pgsql -c -d osm -C 60000 --slim --flat-nodes /local/data/postgresql/flatnodes /local/data/brosip/planet-latest.osm.pbf
-C 60000 sets the node cache to 60000 MB (don't use more, atlantis has 95 GB of RAM, and osm2pgsql will use additional RAM for other stuff). Lower values will increasingly impact the performance to a point where the import will take several months (this is the case with default parameters).
-c means that the database tables are created if missing
-d specifies the database to use
--slim will take much longer, but externalizes some stuff to the disk and to the database itself. Without --slim, you will quickly run out of RAM on atlantis.
--flat-nodes is a file to which parts of the node cache are externalized in --slim mode. This file has to local (e.g. /local/data), the performance will be abysmal over NFS.
After much experimentation, Patrick achieved throughputs of around 5M nodes per second and 82k ways per second.