I want to use ogr2ogr to import data into a PostgreSQL database. Therefore, I create the database like this:
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt update
sudo apt install postgresql
sudo apt install postgis
sudo su postgres
psql
DROP DATABASE globcit;
CREATE DATABASE globcit;
\q
exit
Afterwards, I want to copy polygons from an OSM pbf file to this data base.
ogr2ogr -f PostgreSQL PG:dbname=globcit -nlt GEOMETRY
-sql "select * from multipolygons where natural=\'water\'"
-progress lakes turkey-latest.osm.pbf
(formatted for better reading, usually one-liner)
However I get the error:
FAILURE:
Unable to open datasource `lakes' with the following drivers.
-> PCIDSK
-> netCDF
-> JP2OpenJPEG
-> PDF
-> ESRI Shapefile
....
what am I missing?
lakes
. Or if you want that to be the table name, use-nln lakes
.