[gdal-dev] Fwd: OSRExportToProj4 losing datum
Even Rouault
even.rouault at mines-paris.org
Sat Nov 3 02:39:50 PDT 2012
Selon Oliver Soong <osoong+gdal at gmail.com>:
> The attached raster is in Albers_Conic_Equal_Area on
> North_American_Datum_1983. This is correctly indicated by the WKT.
> The PROJ.4 string has no such datum information. This causes problems
> with rgdal in R, which uses the PROJ.4 string and never receives the
> datum information.
>
> This seems to be limited to Albers_Conic_Equal_Area and
> North_American_Datum_1983, although our testing has been limited.
>
> > gdalinfo --version
> GDAL 1.9.2, released 2012/10/08
> > gdalinfo -proj4 test.tif
> [...]
> Coordinate System is:
> PROJCS["unnamed",
> GEOGCS["NAD83",
> DATUM["North_American_Datum_1983",
> SPHEROID["GRS 1980",6378137,298.2572221010002,
> AUTHORITY["EPSG","7019"]],
> TOWGS84[0,0,0,0,0,0,0],
> AUTHORITY["EPSG","6269"]],
> PRIMEM["Greenwich",0],
> UNIT["degree",0.0174532925199433],
> AUTHORITY["EPSG","4269"]],
> PROJECTION["Albers_Conic_Equal_Area"],
> PARAMETER["standard_parallel_1",29.5],
> PARAMETER["standard_parallel_2",45.5],
> PARAMETER["latitude_of_center",23],
> PARAMETER["longitude_of_center",-96],
> PARAMETER["false_easting",0],
> PARAMETER["false_northing",0],
> UNIT["metre",1,
> AUTHORITY["EPSG","9001"]]]
> PROJ.4 string is:
> '+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0
> +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs '
>
Yes, this is the new behaviour of GDAL since GDAL 1.8. +datum is not emitted
when the TOWGS84 node is present in the WKT. Proj.4 doesn't need +datum when
+ellps and +towgs84 are available. A few applications (like GRASS) seemed to
depend on the presence of +datum but this has never been reliable since PROJ.4
only recognized a small proportion of datum names among all that are possible.
Applications shouldn't rely on proj.4 string to build a SRS, but use the WKT
string / OGRSpatialReference object instead.
http://trac.osgeo.org/gdal/ticket/3450 and http://trac.osgeo.org/proj/ticket/122
for some background. You could also try setting the environmenet variable
OVERRIDE_PROJ_DATUM_WITH_TOWGS84 to FALSE if you really need the old behaviour.
More information about the gdal-dev
mailing list