[gdal-dev] ogr2ogr failing on postgis?

Even Rouault even.rouault at spatialys.com
Sun Apr 10 09:01:54 PDT 2016


Hi Paolo,

> Hi all,
> I have an ogr2ogr command, from shp to pg, that fails because it
> requests write access to spatial_ref_sys. An apparently identical
> command on another file runs smoothly. Any hint?
> Details and data documented here:
> http://hub.qgis.org/issues/14650

Yes, this is expected and a rather common problem with shapefiles. As the 
shapefile .prj doesn't contain any explicit EPSG code, the PostGIS driver tries 
to find a match in spatial_ref_sys based on an exact match on the WKT, but as 
the OGC WKT built from the .prj is different from the one in spatial_ref_sys 
(one of the difference is the absence of the AUTHORITY["EPSG","3003"] node of 
course !), it must fallback to creating an ad-hoc entry, hence the need for 
write access.

Workaround: provide explicit SRS, in that case -a_srs EPSG:3003 (as I can see 
in the .qpj)

A more "fuzzy" indentification of SRS could help for that.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list