I have a georeferenced image and I need to use it as a basemap map, instead of OpenStreetMap. is there a way to do it with simple leaflet?


If the image is not too big, you can avoid the tiling step by simply using an L.imageOverlay:

Used to load and display a single image over specific bounds of the map.

Usage example:

var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
    imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];

L.imageOverlay(imageUrl, imageBounds).addTo(map);

Demo: https://playground-leaflet.rhcloud.com/hijuh/1/edit?html,output


You can create tiles from the georefenced image with gdal2tiles:

gdal2tiles georeference_image.tif output_folder

See the linked documentation for more options.

Now you can include the output directly to your leaflet map:

attribution: 'Georeferenced Image', 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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