1

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.

2
  • That looks a lot larger than RGF93 - WGS84 offset which should at most a meter or so. Are you sure the data's not based on NTF?
    – mkennedy
    Sep 27, 2015 at 14:34
  • Yes, it's EPSG:2154 which according to spatialreference.org/ref/epsg/rgf93-lambert-93 seems to be lambert 93
    – sylvain
    Sep 28, 2015 at 7:22

1 Answer 1

2

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
1
  • gdalwrap seem to be missing some geospatial data to compute transformation (see edited post). Can I add those in gdalwrap parameters ?
    – sylvain
    Oct 2, 2015 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.