PostgreSQL postgis: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
create another, and use directory /opt/data | create another, and use directory /opt/data | ||
psql -d osm | psql -d osm | ||
CREATE | CREATE DATABASE osm2; | ||
CREATE EXTENSION postgis; | CREATE EXTENSION postgis; | ||
CREATE ROLE osm; | CREATE ROLE osm; |
Revision as of 2025-08-25T22:38:30
Example for Ubuntu and osmdb
apt install postgis sudo -u postgres createuser osmuser sudo -u postgres createdb --encoding=UTF8 --owner=osmuser osm sudo -u postgres psql osm --command='CREATE EXTENSION postgis;' psql -d osm SELECT PostGIS_Version(); //verify install quit; apt install osm2pgsql //https://osm2pgsql.org/doc/install/linux.html
wget https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf osm2pgsql -d osm -s berlin-latest.osm.pbf //osm2pgsql took 302s (5m 2s) overall.
create another, and use directory /opt/data
psql -d osm CREATE DATABASE osm2; CREATE EXTENSION postgis; CREATE ROLE osm; ALTER DATABASE osm2 OWNER TO osm; quit cd /opt/data wget https://download.geofabrik.de/europe/germany/brandenburg-latest.osm.pbf osm2pgsql -d osm2 -s brandenburg-latest.osm.pbf
\l+ List of databases Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges | Size | Tablespace | Description -------------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------+---------+------------+-------------------------------------------- osm2 | osmuser | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | | 4771 MB | pg_default |