Jump to content

PostgreSQL postgis: Difference between revisions

From annawiki
Created page with "Example for Ubuntu and osmdb apt install postgis psql -d xxx //xxx=any dbname of a db one can connect to CREATE DATABASE osmdb; \c osmdb; CREATE EXTENSION postgis;"
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Example for Ubuntu and osmdb
Example for Ubuntu and osmdb
  apt install postgis
  apt install postgis
  psql -d xxx //xxx=any dbname of a db one can connect to
sudo -u postgres createuser osmuser
  CREATE DATABASE osmdb;
sudo -u postgres createdb --encoding=UTF8 --owner=osmuser osm
  \c osmdb;
sudo -u postgres psql osm --command='CREATE EXTENSION postgis;'
  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.

Latest revision as of 2025-08-12T14:53:19

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.