[GIS] Use Lambert 93 imageOverlay with Leaflet on top of OSM tiles layer

coordinate systemgdalgdalwarpleafletproj4js

I'm trying to use a Lambert 93 image overlay on top of an Open Street Map title layer.

var map = L.map('map');
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { }).addTo(map);
var coords = {
    x : [-0.734794,-0.418381],
    y : [47.376276,47.572680]
};
var imageBounds = [[coords.y[0], coords.x[0]], [coords.y[1], coords.x[1]]];
L.imageOverlay('image.png', imageBounds, {opacity:0.8}).addTo(map);

The resulting image overlay does not match the underlying OSM map.

enter image description here

OSM and lambert mismatch

It seems that this is because the image.png is in lambert 93 projection.

  • Can I use a lambert 93 image overlay on top of an OSM tiles layer ?
  • If not possible, can I convert my lambert 93 image.png to be usable with OSM tiles layers using tools such as gdalwrap ?

What I tried :

1) Proj4Leaflet

I looked at the Proj4Leaflet project which enables projections and provides an imageOverlay with projection example but the projection systems seems to concern the whole map and I want lambert 93 only on the imageOverlay.

This question seems to exclude the possibility of multiple projections
but as it only focuses on tiles layers I'm not sure this is relevant in my case.

2) gdalwrap

gdalwarp -s_srs EPSG:2154 -t_srs EPSG:3857 -of PNG image-lambert.png image-webmercator.png

=> Output driver `PNG' not recognised or does not support

gdalwarp -s_srs EPSG:2154 -t_srs EPSG:3857 image-lambert.png image-webmercator.tiff

Copying color table from image-lambert.png to new file.
ERROR 1: Unable to compute a transformation between pixel/line
and georeferenced coordinates for image-lambert.png.
There is no affine transformation and no GCPs.

Best Answer

Can I use a lambert 93 image overlay on top of an OSM tiles layer ?

Leaflet is not able to reproject images. In other words: you can not display tiles/images which use different spatial reference systems.

If not possible, can I convert my lambert 93 image.png to be usable with OSM tiles layers using tools such as gdalwrap ?

Sure! Just remember the EPSG codes for Lambert 93 and OSM's web mercator:

gdalwarp -s_srs EPSG:2154 -t_srs EPSG:3857 image-lambert.png image-webmercator.png