Size: 1497
Comment:
|
Size: 1615
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 7: | Line 7: |
== Converting OSM to PostGIS == | == Importing OSM to PostGIS == |
Line 9: | Line 9: |
To import planet.osm, we use {{osm2pgsql}}. Several things have to considered to import planet.osm without running out of memory or time. | |
Line 11: | Line 10: |
The following command is used to import {{planet.osm}}: | 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}}}: |
Line 17: | Line 18: |
{{-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 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 years (this is the case with default parameters). |
Line 19: | Line 20: |
{{-c}} means that the database tables are created if missing | {{{-c}}} means that the database tables are created if missing |
Line 21: | Line 22: |
{{-d]} specifies the database to use | {{{-d}}} specifies the database to use |
Line 23: | 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. |
Line 25: | Line 26: |
{{--flat-nodes}} is a file to which parts of the node cache are externalized. This file has to local (e.g. ``/local/data``), the performance will be abysmal over NFS. | {{{--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. |
Line 27: | Line 28: |
After much experimentation, Patrick achieved throughputs of around 5M nodes per second and 82k ways per second. | After much experimentation, Patrick achieved throughputs of around 5M nodes per second, 82k ways per second and 4 (sic!) relations per second. |
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 years (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, 82k ways per second and 4 (sic!) relations per second.