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

Even Rouault even.rouault at mines-paris.org
Tue Nov 30 09:32:03 EST 2010


Sebastian,

I'd suggest checking what I wrote at the end of my previous email : "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."

The mentionned .sql script is spatial_ref_sys.sql. See
http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392

> I've replaced the -lco 27700 with -a_srs EPSG:27700
>
> now select ST_SRID(wkb_geometry) from sebas
>
> gives 4...
>
> any ideas ?
>
> On Tue, Nov 30, 2010 at 10:59 AM, Even Rouault <even.rouault at mines-paris.org
> > wrote:
>
> > 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
> > >
> >
> >
> >
>
>
> --
> Sebastian E. Ovide
>




More information about the gdal-dev mailing list