[gdal-dev] PG: does OGR2OGR set the SRID correctly ?

Even Rouault even.rouault at mines-paris.org
Tue Nov 30 05:59:28 EST 2010


Selon "Sebastian E. Ovide" <sebastian.ovide at gmail.com>:
Sebastian,

The option "-lco 27700" has no effect. The correct syntax would be something
like "-lco SRID=27700", but there's no such option, so don't loose your time
trying that ;-)

The SRID is set automatically by comparing the SRS of the source layer with what
exists in the spatial_ref_sys table (or the one you can set with the -a_srs
EPSG:27700 as suggested by Jorge). If there's a match, then the SRID from
spatial_ref_sys will be used. Otherwise the PG driver will add a new entry in
the spatial_ref_sys table (and the SRID number will not be equal to the EPSG
code). Make sure you've filled the spatial_ref_sys table
with the appropriate PostGIS .sql script. The '3' you get sounds like the
spatial_ref_sys table of this database was empty and that the PG driver added
new entries in it.

Best regards,

> Hi All,
>
> I've just uploaded a shape with
>
> ogr2ogr -f PostgreSQL "PG:dbname='gis' host='10.0.1.40' port='5432'
> user='gis' password='gis'"  sebas.shp -lco 27700 -lco PRECISION=NO -progress
> -lco OVERWRITE=yes -lco dim=2 -nln sebas -overwrite
>
> but from
>
> select ST_SRID(wkb_geometry) from sebas;
>
> I'm getting 3
>
> (with
>
> select ST_SRID(ST_SetSRID(wkb_geometry,27700)) from sebas;
>
> I'm getting the right value )
>
> any ideas ?
>
>
>
> --
> Sebastian E. Ovide
>




More information about the gdal-dev mailing list