[gdal-dev] gdal_translate eats projection parameter values

Even Rouault even.rouault at mines-paris.org
Fri Aug 12 11:37:19 EDT 2011


Selon Hermann Peifer <peifer at gmx.eu>:

In fact, it is not a bug, but just one of those annoying subtelties you
encounter when playing with projections.

Your .prj file (as most files with .prj extension) doesn't contain the
"standard" OGC WKT formulation that GDAL/OGR uses internally, but a WKT in its
ESRI formulation. You can note the differences in the naming of the parameter :
latitude_of_center(OGC WKT) vs Latitude_Of_Origin (ESRI WKT),
longitude_of_center (OGC WKT) vs Central_Meridian (ESRI WKT)

So you have to specify the formulation to use to GDAL by adding the ESRI::
prefix before the filename, so that GDAL can "morphFromESRI". This is documented
here :

http://gdal.org/ogr/classOGRSpatialReference.html#ec3c6a49533fe457ddc763d699ff8796
.

The SetFromUserInput() is the method used to parse the value of the -a_srs
option.

So :
gdal_translate dummy.asc dummy.tif -a_srs ESRI::ETRS_1989_LAEA_L52_M10.prj

Or you could just copy ETRS_1989_LAEA_L52_M10.prj as dummy.prj, because the
AAIGRID driver will automatically consider that a .prj file is a ESRI one.

Best regards,

Even

>
> Hi,
>
> PARAMETER["Central_Meridian",10.0] from the projection file comes out
> as: PARAMETER["longitude_of_center",0]
>
> PARAMETER["Latitude_Of_Origin",52.0] is changed to
> PARAMETER["latitude_of_center",0]
>
> See the details below. Is there something wrong with my projection file
> or rather with GDAL?
>
> Wondering, Hermann
>
> PS: I am using gdal from trunk, revision 22757 from
> 2011-07-19T18:57:35.878941Z
>
> PPS: I reported a somewhat similar (?) issue 2 years ago, see
> http://trac.osgeo.org/gdal/ticket/3016
>
>
> -----------------------
>
> $ cat dummy.asc
> ncols        1
> nrows        1
> xllcorner    0.0
> yllcorner    0.0
> cellsize     50.0
> NODATA_value -9999
> -9999
> $
> $ cat ETRS_1989_LAEA_L52_M10.prj
>
PROJCS["ETRS_1989_LAEA_L52_M10",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",4321000.0],PARAMETER["False_Northing",3210000.0],PARAMETER["Central_Meridian",10.0],PARAMETER["Latitude_Of_Origin",52.0],UNIT["Meter",1.0]]$
> $
> $ gdal_translate dummy.asc dummy.tif -a_srs ETRS_1989_LAEA_L52_M10.prj
> Input file size is 1, 1
> 0...10...20...30...40...50...60...70...80...90...100 - done.
> $
> $ gdalinfo dummy.tif
> Driver: GTiff/GeoTIFF
> Files: dummy.tif
> Size is 1, 1
> Coordinate System is:
> PROJCS["ETRS_1989_LAEA_L52_M10",
>      GEOGCS["GCS_ETRS_1989",
>          DATUM["D_ETRS_1989",
>              SPHEROID["GRS_1980",6378137,298.257222101]],
>          PRIMEM["Greenwich",0],
>          UNIT["degree",0.0174532925199433]],
>      PROJECTION["Lambert_Azimuthal_Equal_Area"],
>      PARAMETER["latitude_of_center",0],
>      PARAMETER["longitude_of_center",0],
>      PARAMETER["false_easting",4321000],
>      PARAMETER["false_northing",3210000],
>      UNIT["metre",1,
>          AUTHORITY["EPSG","9001"]]]
> Origin = (0.000000000000000,50.000000000000000)
> Pixel Size = (50.000000000000000,-50.000000000000000)
> Metadata:
>    AREA_OR_POINT=Area
> Image Structure Metadata:
>    INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (   0.0000000,  50.0000000) ( 43d40' 8.77"W, 27d18'43.27"S)
> Lower Left  (   0.0000000,   0.0000000) ( 43d40' 9.28"W, 27d18'44.80"S)
> Upper Right (  50.0000000,  50.0000000) ( 43d40' 6.89"W, 27d18'43.45"S)
> Lower Right (  50.0000000,   0.0000000) ( 43d40' 7.41"W, 27d18'44.97"S)
> Center      (  25.0000000,  25.0000000) ( 43d40' 8.09"W, 27d18'44.12"S)
> Band 1 Block=1x1 Type=Int32, ColorInterp=Gray
>    NoData Value=-9999
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list