[Gdal-dev] ogr2ogr Default Output SRS
warmerdam at pobox.com
Sun Dec 10 00:24:34 EST 2006
Martin Spott wrote:
> Hi Frank, thanks for responding,
> Frank Warmerdam wrote:
>> There are some "sensitivities" in how ogr2ogr identifies which SRID to use
>> in postgis. If it doesn't find a match then it creates a new SRID at the
>> "top" of the table, which I suspect did for the 32767 case.
>> It may be that the spatial_ref_sys tables in your different versions of
>> postgis are slightly different in the formatting of the WKT entries and
>> this is in one SRID 4326 gets used and in the other it doesn't.
> But what can a user actually do about this, whose "fault" is it if
> 'ogr2ogr' and PostGIS don't place together nicely, and, which I
> consider even more important, which route to take to solve this issue ?
Normally there is no great harm in creating a new SRID for what is a
slightly different formatting of a coordinate system that from a
meaningful point of view matches an existing SRID.
However, the solution, I think would be for OGR to:
o Do the search based on the proj.4 string rather than the WKT.
The proj.4 strings are less likely to suffer from formatting
variations over time.
o Provide a mechanism (a layer creation option for instance) so
that the user can force use of a particular SRID whether OGR
thinks the coordinate systems match or not.
> Apparently PostGIS started shipping newer versions of the
> spatial_ref_sys table with 1.1.6 and 'ogr2ogr' somehow doesn't 'agree'
> with the contents of this table.
> I just ran a test with PostGIS-1.2.0 - same effect as with 1.1.6, still
> using the respective spatial_ref_sys that comes with the very PostGIS
> release. I then pushed the contents of the spatial_ref_sys table from
> PostGIS-1.1.5 into the DB, still running PostGIS-1.2.0, and everything
> is fine. So, is this sort of a bug in 'ogr2ogr' that shows some
> incapability to handle newer EPSG declarations or is this to be
> considered as a misfeature in the recent EPSG files that breaks
> 'ogr2ogr' ?
Note that the spatial_ref_sys for PostGIS is generated with OGR. So
there is no reason to believe the newer spatial_ref_sys will differ
from what newer OGR versions expect. Upgrading GDAL/OGR may therefore
Generally speaking comparing coordinate systems is *hard*. Especially if
you wish to do so efficiently.
If you file a bug against OGR with the two earlier suggestions, I'll try
and have them implemented at some point. Ideally in time for the GDAL
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 OSGeo, http://osgeo.org
More information about the Gdal-dev