I am a starter to use command-line interface. I was looking for a way to import a shapefile into PostgreSQL using "ogr2ogr". I was able to do this for point shapefile using code:

ogr2ogr -f "POSTGRESQL" PG:"host=localhost user=postgres dbname=postgres password=12345" "C:\Users\itsaa\Desktop\GIS DATA\WGS\sett.shp"

But using the same code for Multipolygon feature gave me an error message Error

How can I get through this?

  • Are you using the latest version of the tool?
    – GforGIS
    Feb 5, 2020 at 5:40
  • 3
    That error is about the file. Does it exist? Is it a valid shapefile? Feb 5, 2020 at 6:16
  • 1
    Test with ogrinfo: ogrinfo "C:\Users\itsaa\Desktop\GIS DATA\WGS\your_polygon_shape.shp". Does it find your shapefile? I would not recommend to use spaces in the names of files and directories but with double quotes they should work. Also "Desctop" may not be the best choice for data, try something like C:\Users\itsaa\data instead, or just c:\data.
    – user30184
    Feb 5, 2020 at 7:27
  • 3
    please don't use screenshots to display errors, it is very easy to cut and paste from a windows command window.
    – Ian Turton
    Feb 5, 2020 at 8:27
  • you can also try to use the QGIS DB Manager to insert your Shapefile into Postgres. Feb 5, 2020 at 11:04

1 Answer 1


I suggest you use the PostGIS tool to load the shapefile. Please check the following link:


  • 1
    Using PostGIS I was able to do so. I want to use ogr2ogr code for the purpose. Feb 5, 2020 at 5:34
  • find here some example how to use ogr2ogr with PostGIS Feb 5, 2020 at 11:06
  • I cannot find the solution to my problem in the mentionedd page Feb 5, 2020 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.