[gdal-dev] PostGIS layer SRS

Even Rouault even.rouault at spatialys.com
Tue Aug 30 02:15:50 PDT 2016


Hi Ari,

> 
> How does one set the SRS of a new PostGIS layer (especially from the
> bindings)?

With the srs parameter of Dataset.CreateLayer()

> It does not seem to work with simply setting it with the
> workflow: get geometry field definition and call SetSpatialRef on it.

Once the geometry field is created, it is too late, and any attempt to modify 
it will have no effect on how it is serialized.

But if you call AddGeomFieldDefn() (for layers with multiple geometry columns) 
with a geometry field definition that has the SRS set, that should be used too 
to record it in the DB.

Even

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


More information about the gdal-dev mailing list