More

Transform an image with projection EPSG:4326 to EPSG:3857

Transform an image with projection EPSG:4326 to EPSG:3857


I have an image with known boundary and projection EPSG:4326 and want to overlay it to openstreetmap using Leaflet.js.

I have tried using function imageoverlay, but the image is not aligned with the basemap.

L.imageOverlay(imgUrl, [[-15, 75], [45, 145]], {opacity: 0.6, autoZIndex: true});

So, I use gdalwarp to transform the image projection to EPSG:3857.

gdal_translate -of Gtiff -a_ullr -15 145 45 75 -a_srs EPSG:4326 test.png">

Here is the final image


gdal_translate expects the extent in the format-a_ullr ulx uly lrx lry. Form the picture I guess you swapped x (Easting) and y (Northing), and upper left and lower right.

I get the right picture with:

gdal_translate -of Gtiff -a_ullr 75 45 145 -15 -a_srs EPSG:4326 CJGMY.png">

For the correct leaflet syntax, see http://leafletjs.com/reference.html#imageoverlay

var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg">ShareImprove this answeredited Dec 22 '15 at 14:42answered Dec 22 '15 at 11:16AndreJAndreJ73.5k5 gold badges76 silver badges147 bronze badges
							

Watch the video: QGIS: EPSG 4326 vs EPSG 3004