6

The .shp, .dbf and the rest of files are fine, I open them in QGIS, AGOL with no problem. In fact, I've tried 3 different layers, and get always the same error.

Anyone can please help, as I really need to migrate my .shp's to postgis, and have no idea of why it's not able to open .dbf?

Postgres v9.3 x86 Postgis shapefile loader v2.1

Thanks a lot in advance!

PS I've tried changing the default character encoding from the default 'UTF-8' to 'ISO 8859-14' but same error.

  • Have you tried the shp2pgsql-gui tool? – DPSSpatial Oct 18 '13 at 15:20
  • And are you trying to import just a .DBF, or an entire shapefile including .DBF? – DPSSpatial Oct 18 '13 at 15:20
  • Do you close your layers in QGIS or maybe OpenOffice if you opened the DBF like that? Sometimes, problems only comes from a lock between programs – ThomasG77 Oct 18 '13 at 17:34
  • could be permissions issues on your .dbf files – Farhat Abbas Oct 18 '13 at 18:57
  • Without seeing the files themselves, there's no way to debug or replicate this. – Paul Ramsey Oct 20 '13 at 17:43
3

Please check out http://www.gdal.org/ogr/drv_pg.html GDAL OGR2OGR to load shapefile data into postgis

Ogr2ogr Command to import shape into postgis

ogr2ogr -f "PostgreSQL" PG:"host=myhost user=username dbname=mydbname password=mypassword" your_shapefile.shp

For details http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet

  • Thanks a lot Farhat, what finally seems to have worked (further checking pending) is importing geodatabase files into postgres using OGR2OGR. Great tools, thanks a lot again! – Guillermo Oct 22 '13 at 9:33
  • 1
    That link doesn't work anymore. – Gabriel Fair Oct 20 '17 at 15:21
6

I just faced the same problem. I solved it by changing the location of shapefile. It seemed a problem of too long file name. When I moved the files up in folder tree, it worked perfectly, using the plugin.

  • this seems to be the good one, worked fine for me aswell, thanks a lot Sergio! – Guillermo Oct 17 '14 at 12:11
  • Also had this problem with PostGIS 2.4.2 and filename probably too long or with special characters (accented letters). – kogexo Jan 25 '18 at 11:47
1

I've had the same error. In my case the solution is also the path name. The path name must not have any special characters like ä,ö or ü.

1

In PostGIS 2.4 I ran into this because I tried passed DB credentials following earlier versions -- you must pipe to psql instead now, e.g.:

shp2pgsql shaperoads.shp myschema.roadstable | psql -d roadsdb

In short, this error often shows up for unrelated problems (any kind of bad input or options).

0

DBF files can be opened by the dint of foxpro dbf recovery software

More info about this solution on oemailrecovery.com.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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