Discussion:
[gdal-dev] ogr2ogr and PostGIS 2.0
EdH
2013-03-20 14:19:43 UTC
Permalink
Hi,

I'm trying to extract a table from PostGIS into a shapefile. Using the
command:

"c:\Program Files\Quantum GIS Lisboa\bin\ogr2ogr.exe" -f "ESRI Shapefile"
c:\test\planning.shp PG:"host=w2k3nnpgis1 user=postgres dbname=mapdata
password=********" "dm_planning-apps"

And I get this error:

ERROR 1: No field definitions found for 'dm_planning-apps', is it a table?
FAILURE: Couldn't fetch requested layer 'dm_planning-apps'!

Using the same command with a different db connection works fine. The
difference being that the failure happens on PostgreSQL 9.1.4 with PostGIS
2.0 installed, and I think the other db is on an older installation (I don't
manage the working one).

Judging by other posts it seems like ogr2ogr thinks that the data isn't in
the geomety_columns table, however I notice PostGIS 2.0 has replaced the
geometry columns table with a 'view'. Might this be anything to do with it?

Many thanks if anyone can help with this.




--
View this message in context: http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
Armin Schmidt
2013-03-21 08:48:11 UTC
Permalink
Might this be a problem with your table's name: "dm_planning-apps" ? Having a
hyphen in a table's name can have all sorts of side effects.
Armin



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735p5041984.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
EdH
2013-03-21 09:50:45 UTC
Permalink
Thanks for this suggestion, but I'm still getting the same error when I try
another table in the same db called "lnr" (i.e. no hyphens).





--
View this message in context: http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735p5042009.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
Even Rouault
2013-03-21 09:54:07 UTC
Permalink
Post by EdH
Thanks for this suggestion, but I'm still getting the same error when I try
another table in the same db called "lnr" (i.e. no hyphens).
You didn't specify which GDAL/OGR version you are using. You need GDAL/OGR 1.9
or later for PostGIS 2.0 compatibility.
Post by EdH
--
http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735p5042009.html
Post by EdH
Sent from the GDAL - Dev mailing list archive at Nabble.com.
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
EdH
2013-03-21 11:48:00 UTC
Permalink
Just installed GDAL 1.9.2 and am having the same error.

When I run a query in PGadmin to show all tables the gemoetry columns "view"
does not appear but the other three "views" do (e.g. geography columns
etc...)



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735p5042046.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
Even Rouault
2013-03-21 11:58:37 UTC
Permalink
Post by EdH
Just installed GDAL 1.9.2 and am having the same error.
When I run a query in PGadmin to show all tables the gemoetry columns "view"
does not appear but the other three "views" do (e.g. geography columns
etc...)
Ah then it is likely a problem with the setup of your database. Or perhaps a
permission problem for the user opening the database.
Post by EdH
--
http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735p5042046.html
Post by EdH
Sent from the GDAL - Dev mailing list archive at Nabble.com.
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
EdH
2013-03-21 12:36:32 UTC
Permalink
Hi,

It's the superuser of the whole db cluster so I'd be surprised if its a
permissions error.

Any ideas what might be wrong in the setup to cause this or how i might
diagnose a problem?





--
View this message in context: http://osgeo-org.1560.n6.nabble.com/ogr2ogr-and-PostGIS-2-0-tp5041735p5042074.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

Loading...