[Gdal-dev] specifiying the correct SRID when sending polygons to PostGIS

Frank Warmerdam warmerdam at pobox.com
Tue Jul 11 17:03:25 EDT 2006


Dylan Beaudette wrote:
> Hi everyone,
> 
> I have just noticed that when importing some polygons data into PostGIS with 
> ogr2ogr:
> 
> ogr2ogr -nln mapunit -update -append -t_srs '+proj=aea +x_0=0.0 +y_0=0 
> +lon_0=-96 +lat_0=40.0 +lat_1=20 +lat_2=60.0 +datum=NAD83' -f "PostgreSQL" 
> PG:"dbname=ssurgo_combined user=postgres password=xxx host=xxx" file.shp
> 
> 
> ... the SRID of the wkb_geometry column is set to 32767. Could this be due to 
> the fact that the ourput projection that I am specifying via proj4 style 
> syntax is not in the proj/epsg file? Is there anyway to manually specify the 
> SRID that I want PostGIS to enforce on this geometry, something like an 
> option: -force-srid 9001 . where 9001 is a custom SRID that I have added to 
> PostGIS ? 

Dylan,

There is currently no option to force use of a particular SRID by SRID.
What OGR does is search for an entry in spatial_ref_sys that has a WKT
value exactly matching the one you have associated with the layer being
created.  So if you have associated WKT for SRID 9001 in the spatial_ref_sys
table, then you should be able to force ogr2ogr to use that entry by
using the same WKT.  For instance, save it to a text file called 9001.wkt
and then do

ogr2ogr ... -a_srs ./9001.wkt

Hopefully that will result in a match and use of SRID 9001.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list