[gdal-dev] GetProjectionRef returns invalid projection

Frank Hübenthal huebenthal at uxis.de
Fri Apr 15 05:24:44 PDT 2022


Perfect. This works.

Thank you,

Frank

Am 15.04.2022 um 14:08 schrieb Even Rouault:
> Tihs works fine for me:
>
> $ python -c "from osgeo import gdal; ds= 
> gdal.Open('/home/even/Téléchargements/OFM.tif'); 
> print(ds.GetProjectionRef())"
> PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 
> 84",DATUM["WGS_1984",SPHEROID["WGS 
> 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],EXTENSION["PROJ4","+proj=merc 
> +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m 
> +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]
>
> However I suspect that your issue is that PROJ is misconfigured and 
> cannot find its proj.db. Make sure that PROJ_LIB points to the 
> directory where proj.db is located
>
> I can reproduce your issue by setting a wrong path for PROJ_LIB:
>
> $ PROJ_LIB=/unexisting/path python -c "from osgeo import gdal; ds= 
> gdal.Open('/home/even/Téléchargements/OFM.tif'); 
> print(ds.GetProjectionRef())"
> Warning 1: PROJ: proj_create_from_database: Cannot find proj.db
> Warning 1: The definition of projected CRS EPSG:3857 got from GeoTIFF 
> keys is not the same as the one from the EPSG registry, which may 
> cause issues during reprojection operations. Set GTIFF_SRS_SOURCE 
> configuration option to EPSG to use official parameters (overriding 
> the ones from GeoTIFF keys), or to GEOKEYS to use custom values from 
> GeoTIFF keys and drop the EPSG code.
> LOCAL_CS["WGS 84 / 
> Pseudo-Mercator",UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]]
>
> Le 15/04/2022 à 13:52, Frank Hübenthal a écrit :
>> Here it is: https://easyupload.io/rg2ltd
>>
>> Unfortunately It is rather big (36MB).
>>
>> Best regards,
>>
>> Frank
>>
>> Am 15.04.2022 um 13:41 schrieb Even Rouault:
>>> Frank,
>>>
>>> please provide a link to such file
>>>
>>> Even
>>>
>>> Le 15/04/2022 à 13:27, Frank Hübenthal a écrit :
>>>> I use GDAL C++ to load GeoTIFF files. Since I moved to GDAL 3.4 I 
>>>> have problems to get the projection string from some (not all) of 
>>>> these GeoTIFF files. With GDAL 3.2 still something like this was 
>>>> returned:
>>>>
>>>> PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 
>>>> 84",DATUM["WGS_1984",SPHEROID["WGS 
>>>> 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],EXTENSION["PROJ4","+proj=merc 
>>>> +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 
>>>> +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]
>>>>
>>>> With GDAL 3.4 I get for the same map file only this:
>>>>
>>>> "LOCAL_CS["WGS 84 / 
>>>> Pseudo-Mercator",UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","3857"]]"
>>>>
>>>> I use the projection to create finally a transformation, but 
>>>> OGRCreateCoordinateTransformation returns NULL with the short 
>>>> string from GDAL 3.4 while it was still working with 3.2.
>>>>
>>>> Best regards,
>>>>
>>>> Frank
>>>>
>>>>
>>>> _______________________________________________
>>>> gdal-dev mailing list
>>>> gdal-dev at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>



More information about the gdal-dev mailing list