[Gdal-dev] RE: ogr2ogr to PostGIS gives wrong SRID?

Maciej Sieczka tutey at o2.pl
Sat Dec 29 18:29:12 EST 2007


Frank Warmerdam wrote:
> Maciej Sieczka wrote:

>> If the comparison of OGR's EPSG->WKT with PostGIS's "srtext"
>> is error-prone, could OGR instead just look-up the
>> spatial_ref_sys table for "auth_srid" equal to the EPSG code
>> specified, check if "auth_name" is "EPSG" and use the
>> "auth_srid" value then? That would guarantee that a correct
>> EPSG code is used; see:
>>
>> SELECT srid,auth_name,auth_srid FROM spatial_ref_sys WHERE
>> auth_srid=2180;
>>
>>  srid | auth_name | auth_srid
>> ------+-----------+-----------
>>  2180 | EPSG      |      2180

> For OGR spatial references with an authority code set, this
> would be a valuable pre-search, but it is at most a special
> case (though a reasonable common one).

FWIW, it's a PostGIS default.

>> Hmm, actualy, all "auth_name" fields in my spatial_ref_sys
>> are "EPSG", and all "srid" and "auth_srid" are the same; but
>> that's maybe just me:

> I'd suggest you search for existing open tickets against the postgis
> driver on this issue, and append some of the above notes.  In particular
> the suggestion to first search based on the authority id if it is
> available.

I couldn't find any open ticket on a related issue. Created
a new one [1].

> Hopefully Mateusz can work on some improvements in this area in the coming
> months.

That'd be great. Thanks.

Maciek

[1]http://trac.osgeo.org/gdal/ticket/2123


More information about the gdal-dev mailing list