[gdal-dev] EPSG code not recognized from GeoTiff written by GDAL

Even Rouault even.rouault at spatialys.com
Fri May 27 15:48:11 PDT 2016


 
> gdal_translate -a_srs EPSG:25832 in.tif out.tif adds the AUTHORITY parameter
> to the GeoTIFF, while gdal_edit -a_srs EPSG:25832 does not.

That's weird that gdal_edit does'nt set it correctly. I just tested it and it 
works for me.


$ cp autotest/gcore/data/byte.tif tmp.tif; python 
gdal/swig/python/scripts/gdal_edit.py -a_srs EPSG:25832 tmp.tif

$ gdalinfo tmp.tif
Driver: GTiff/GeoTIFF
Files: tmp.tif
Size is 20, 20
Coordinate System is:
PROJCS["ETRS89 / UTM zone 32N",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","25832"]]

 
> Kind regards,
> Stefan 
> 
> P.S.: This is the output from listgeo
> LC81980182015183LGN00_LST_const_LC.tif
 TIFFReadDirectory: Warning, Unknown
> field with tag 42112 (0xa480) encountered. TIFFReadDirectory: Warning,
> Unknown field with tag 42113 (0xa481) encountered. Geotiff_Information:
>    Version: 1
>    Key_Revision: 1.0
>    Tagged_Information:
>       ModelTiepointTag (2,3):
>          0                 0                 0
>          417585            6784515           0
>       ModelPixelScaleTag (1,3):
>          30                30                0
>       End_Of_Tags.
>    Keyed_Information:
>       GTModelTypeGeoKey (Short,1): ModelTypeProjected
>       GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
>       GTCitationGeoKey (Ascii,30): "Universal Transverse Mercator"
>       GeographicTypeGeoKey (Short,1): User-Defined
>       GeogCitationGeoKey (Ascii,80): "GCS Name = grs80|Ellipsoid =
> Geodetic_Refe
 rence_System_1980|Primem = Greenwich|"
>       GeogGeodeticDatumGeoKey (Short,1):
> Datum_European_Reference_System_1989
 GeogAngularUnitsGeoKey (Short,1):
> Angular_Degree
>       GeogSemiMajorAxisGeoKey (Double,1): 6378137
>       GeogInvFlatteningGeoKey (Double,1): 298.257222101
>       GeogPrimeMeridianLongGeoKey (Double,1): 0
>       ProjectedCSTypeGeoKey (Short,1): User-Defined
>       ProjectionGeoKey (Short,1): Proj_UTM_zone_32N
>       ProjLinearUnitsGeoKey (Short,1): Linear_Meter
>       End_Of_Keys.
>    End_Of_Geotiff.
> 
> Projection = 16032 (UTM zone 32N)
> Projection Method: CT_TransverseMercator
>    ProjNatOriginLatGeoKey: 0.000000 (  0d 0' 0.00"N)
>    ProjNatOriginLongGeoKey: 9.000000 (  9d 0' 0.00"E)
>    ProjScaleAtNatOriginGeoKey: 0.999600
>    ProjFalseEastingGeoKey: 500000.000000 m
>    ProjFalseNorthingGeoKey: 0.000000 m
> Datum: 6258/European Terrestrial Reference System 1989
> Ellipsoid: 7019/GRS 1980 (6378137.00,6356752.31)
> Projection Linear Units: 9001/metre (1.000000m)
> 
> Corner Coordinates:
> Upper Left    (  417585.000, 6784515.000)  (  7d28' 1.67"E, 61d11'11.02"N)
> Lower Left    (  417585.000, 6538485.000)  (  7d33'58.86"E, 58d58'40.77"N)
> Upper Right   (  660915.000, 6784515.000)  ( 11d59'28.13"E, 61d 9'43.28"N)
> Lower Right   (  660915.000, 6538485.000)  ( 11d47'51.98"E, 58d57'20.48"N)
> Center        (  539250.000, 6661500.000)  (  9d42'20.11"E, 60d 5'19.35"N)
> 
> 
> 
> -----Original Message-----
> From: gdal-dev [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Even
> Rouault
 Sent: 27. mai 2016 14:28
> To: gdal-dev at lists.osgeo.org
> Cc: Jukka Rahkonen <jukka.rahkonen at maanmittauslaitos.fi>
> Subject: Re: [gdal-dev] EPSG code not recognized from GeoTiff written by
> GDAL
 
> On Friday 27 May 2016 11:46:14 Jukka Rahkonen wrote:
> 
> > Blumentrath, Stefan <Stefan.Blumentrath <at> nina.no> writes:
> > 
> > > Hei,
> > > 
> > >  
> > > 
> > > We are facing issues with GeoTiffs that were written by GDAL, after
> > 
> > 
> > importing them to GeoServer or opening in Desktop GIS.
> > 
> > 
> > > On file was produced in GRASS and exported using r.out.gdal (GDAL 
> > > 2.1dev),
> > 
> > 
> > the other file in R, using rgdal (GDAL2.0.x) with EPSG code 25832.
> > 
> > 
> > > The rasters seem to miss the AUTHORITY parameter...
> > > 
> > >  
> > > 
> > > QGIS for example detects EPSG 3044 (which is technically identical), 
> > > and
> > 
> > 
> > GeoServer considers the CRS as invalid (because of this:
> > 
> > http://docs.geonode.org/en/master/tutorials/advanced/geonode_productio
> > n/adv_
> > gsconfig/crs_handling.html).
> > 
> > >  
> > > 
> > > Did anyone else experience the same?
> > 
> > 
> > Hi,
> > 
> > From my GDAL 2.1-dev
> > 
> > gdalsrsinfo epsg:25832
> > 
> > PROJ.4 : '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 
> > +units=m
> > +no_de fs '
> > 
> > OGC WKT :
> > PROJCS["ETRS89 / UTM zone 32N",
> > 
> >     GEOGCS["ETRS89",
> >     
> >         DATUM["European_Terrestrial_Reference_System_1989",
> >         
> >             SPHEROID["GRS 1980",6378137,298.257222101,
> >             
> >                 AUTHORITY["EPSG","7019"]],
> >             
> >             TOWGS84[0,0,0,0,0,0,0],
> >             AUTHORITY["EPSG","6258"]],
> >         
> >         PRIMEM["Greenwich",0,
> >         
> >             AUTHORITY["EPSG","8901"]],
> >         
> >         UNIT["degree",0.0174532925199433,
> >         
> >             AUTHORITY["EPSG","9122"]],
> >         
> >         AUTHORITY["EPSG","4258"]],
> >     
> >     PROJECTION["Transverse_Mercator"],
> >     PARAMETER["latitude_of_origin",0],
> >     PARAMETER["central_meridian",9],
> >     PARAMETER["scale_factor",0.9996],
> >     PARAMETER["false_easting",500000],
> >     PARAMETER["false_northing",0],
> >     UNIT["metre",1,
> >     
> >         AUTHORITY["EPSG","9001"]],
> >     
> >     AXIS["Easting",EAST],
> >     AXIS["Northing",NORTH],
> >     AUTHORITY["EPSG","25832"]]
> > 
> > 
> > 
> > Do you get the same result? If you do I wonder why AUTHORITY is not 
> > written into GeoTIFF.
> 
> 
> 
> For diagnosing, what is interesting is the output of the listgeo utility
> that comes with libgeotiff.
 Theoretically the EPSG code should be
> preserved in the geotiff keys if it is available in the source raster
> (gdal_translate use case), or if set with the SetProjection() API. I'm not
> sure about GRASS or R but perhaps they build the GDAL SRS object from a
> proj.4 string, in which case the EPSG code will be missing. 
> 
> 
> > 
> > -Jukka Rahkonen-
> > 
> > 
> > >  
> > > 
> > > Kind regards,
> > > Stefan
> > 
> > 
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 
> --
> Spatialys - Geospatial professional services http://www.spatialys.com
> _______________________________________________
 gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list