[FWTools] ogr2ogr: shapefile to postgis SRID problem

Frans Knibbe frans at geodan.nl
Fri Nov 4 04:08:16 EST 2005


Meanwhile, I have figured out how to change the SRID in PostGIS, so this 
matter is not so urgent anymore.

An example:

ALTER TABLE gem2003 drop constraint enforce_srid_wkb_geometry;
update gem2003 set wkb_geometry=setsrid(wkb_geometry, 28992);
ALTER TABLE gem2003 add constraint enforce_srid_wkb_geometry CHECK 
(srid(wkb_geometry) = 28992);

My problem was that I used the PostGIS documentation in PDF, where the 
setsrid is missing a viral parameter (the SRID).



Frans Knibbe wrote:

> Hello list,
> I have installed FWTools 1.0.0a5 and I am using ogr2ogr to load data 
> from shapefile to PostGIS (PostgreSQL 8.0.3). I am using a command 
> like this:
> ogr2ogr -f PostgreSQL -a_srs EPSG:28992 PG:"host=<hostname> 
> user=<user> dbname=<database_name>" E:\data\gem2003.shp
> The data are loaded in the database but the SRS is not set correctly: 
> a SRID of 32768 is assigned to the geometries. Since I (yet) don't 
> know how to correct this in PostGIS I would like to know how  ogr2ogr 
> can be persuaded to write the right EPSG code to PostGIS.
> Regards,
> Frans Knibbe
> _______________________________________________
> FWTools mailing list
> FWTools at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/fwtools
> http://fwtools.maptools.org/

More information about the FWTools mailing list