Pergunta

I have a png image that shows the region defined by the geo bounds UpperLat, LeftLon, BottomLat, RightLon (in degrees & -ve for West Lon and South Lat) in Plate Carree EPSG:4326. I want to convert it to Mercator EPSG:3857 using GDAL.

When I tried doing it this way:

Step1) gdal_translate -of Gtiff -a_srs EPSG:4326 pc_map_piece.png pc_map_piece.tiff
Step2) gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 pc_map_piece.tiff mer_map_piece.tiff

I got this error:

ERROR 1: Unable to compute a transformation between pixel/line and georeferenced coordinates for pc_map_piece.tiff. There is no affine transformation and no GCPs.

Then I tried doing it this way:

Step1) gdal_translate -of Gtiff -a_ullr UpperLat LeftLon BottomLat RightLon -a_srs EPSG:4326 pc_map_piece.png pc_map_piece.tiff
Step2) gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 pc_map_piece.tiff mer_map_piece.tiff

I didn't get the above error but the output image is not converted to mercator projection, I simply got the same image upside down as output.

Any ideas to get around this problem and convert the image to Mercator? Thanks.

Foi útil?

Solução

Problem solved. Changing the order to LeftLon UpperLat RightLon BottomLat in my second approach gdal_translate did it for me!!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top