[GIS] Unable find driver PostgreSQL in ogr2ogr

ogr2ogropenstreetmappostgispostgresql

I need use ogr2ogr tool for import osm into PostgreSQL database. I've tried this command:

ogr2ogr -f PostgreSQL PG:"dbname='OSM_DB' host='localhost'
port='5432' user='postgres' password='postgres'"
"E:\Sources\OSM Data\map.osm.pbf"

I'll use ogr2ogr.exe which is default added into my PostgreSQL 9.6 installation bin folder. It return this error:

ERROR 1: Unable to find driver PostgreSQL'.
The following drivers are available:
->
PCIDSK'
-> JP2OpenJPEG'
->
PDF'
-> ESRI Shapefile'
->
MapInfo File'
-> UK .NTF'
->
OGR_SDTS'
-> S57'
->
DGN'
-> OGR_VRT'
->
REC'
-> Memory'
->
BNA'
-> CSV'
->
GML'
-> GPX'
->
KML'
-> GeoJSON'
->
OGR_GMT'
-> GPKG'
->
SQLite'
-> ODBC'
->
WAsP'
-> PGeo'
->
MSSQLSpatial'
-> OpenFileGDB'
->
XPlane'
-> DXF'
->
Geoconcept'
-> GeoRSS'
->
GPSTrackMaker'
-> VFK'
->
PGDUMP'
-> OSM'
->
GPSBabel'
-> SUA'
->
OpenAir'
-> OGR_PDS'
->
WFS'
-> HTF'
->
AeronavFAA'
-> Geomedia'
->
EDIGEO'
-> GFT'
->
SVG'
-> CouchDB'
->
Cloudant'
-> Idrisi'
->
ARCGEN'
-> SEGUKOOA'
->
SEGY'
-> XLS'
->
ODS'
-> XLSX'
->
ElasticSearch'
-> Walk'
->
CartoDB'
-> AmigoCloud'
->
SXF'
-> Selafin'
->
JML'
-> PLSCENES'
->
CSW'
-> VDV'
->
TIGER'
-> AVCBin'
->
AVCE00'
-> `HTTP'

Can you tell me how can I fix it ? I am using windows OS.

Best Answer

Solution is install OSGeo4W GDAL, and run ogr2ogr from bin folder. (OsGeo4W shell not working for me. Give it me error unable load datasource *.osm.pbf).

After installation run command from directory where *.osm.pbf is located

ogr2ogr -f PostgreSQL PG:"dbname='myDB' host='localhost' port='5432' user='postgres' password='postgres'" "data.osm.pbf"

otherwise, give full file path. and done :) additional information about other parameters are here: http://www.gdal.org/drv_osm.html

Related Question