[gdal-dev] A strange thing with a png geospatial file and gdalwarp. Is it a bug?

peifer peifer at gmx.eu
Wed Sep 4 04:55:11 PDT 2013


aborruso wrote
> Dear all, 
> I have a geospatial png file - http://ge.tt/7tmMR7r/v/0?c -and gdalinfo
> give me this projection info: 
> 
> PROJCS["Popular Visualisation CRS / Mercator", 
>     GEOGCS["Popular Visualisation CRS", 
>         DATUM["Popular_Visualisation_Datum", 
>             SPHEROID["Popular Visualisation Sphere",6378137,0, 
>                 AUTHORITY["EPSG","7059"]], 
>             TOWGS84[0,0,0,0,0,0,0], 
>             AUTHORITY["EPSG","6055"]], 
>         PRIMEM["Greenwich",0, 
>             AUTHORITY["EPSG","8901"]], 
>         UNIT["degree",0.01745329251994328, 
>             AUTHORITY["EPSG","9122"]], 
>         AUTHORITY["EPSG","4055"]], 
>     UNIT["metre",1, 
>         AUTHORITY["EPSG","9001"]], 
>     PROJECTION["Mercator_1SP"], 
>     PARAMETER["central_meridian",0], 
>     PARAMETER["scale_factor",1], 
>     PARAMETER["false_easting",0], 
>     PARAMETER["false_northing",0], 
>     AUTHORITY["EPSG","3785"], 
>     AXIS["X",EAST], 
>     AXIS["Y",NORTH]] 
> 
> It's EPSG:3785. 
> 
> If I run this command: 
> 
> gdalwarp -s_srs EPSG:3785 -t_srs EPSG:4326 -of GTiff "input.png"
> "output.tif"   
> 
> The output file has this extent: 
> 
> Upper Left  (  -0.6064394,  44.7016078) (  0d36'23.18"W, 44d42' 5.79"N) 
> Lower Left  (  -0.6064394,  44.6980730) (  0d36'23.18"W, 44d41'53.06"N) 
> Upper Right (  -0.5975973,  44.7016078) (  0d35'51.35"W, 44d42' 5.79"N) 
> Lower Right (  -0.5975973,  44.6980730) (  0d35'51.35"W, 44d41'53.06"N) 
> Center      (  -0.6020184,  44.6998404) (  0d36' 7.27"W, 44d41'59.43"N) 
> 
> If I run this command, without -s_srs parameter: 
> 
> gdalwarp  -t_srs EPSG:4326 -of GTiff "Avenue de Mont-de-Marsan.png"
> "male.tif" 
> 
> This output has an extent that is different from the previous (look at
> latitude): 
> 
> Upper Left  (  -0.6064394,  44.8937072) (  0d36'23.18"W, 44d53'37.35"N) 
> Lower Left  (  -0.6064394,  44.8901724) (  0d36'23.18"W, 44d53'24.62"N) 
> Upper Right (  -0.5975973,  44.8937072) (  0d35'51.35"W, 44d53'37.35"N) 
> Lower Right (  -0.5975973,  44.8901724) (  0d35'51.35"W, 44d53'24.62"N) 
> Center      (  -0.6020183,  44.8919398) (  0d36' 7.27"W, 44d53'30.98"N) 
> 
> Is it normal? 

At least it isn't a bug. Without -s_srs, the CRS info from the png file is
used which specifies TOWGS84[0,0,0,0,0,0,0]. When specifying the EPSG code
via -s_srs, the parameter +nadgrids=@null is used (in both cases EPSG:3857
and EPSG:3785).

In the former case, a "change of ellipsoid" is performed during coordinate
transformation (from the sphere to WGS84), in the latter case, this isn't
done. The difference is a latitude-only offset of around 20 km. What you
usually want is the latter transformation, i.e.  no change of ellipsoid.

Hermann




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/A-strange-thing-with-a-png-geospatial-file-and-gdalwarp-Is-it-a-bug-tp5075948p5075998.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list