CEM How to generate tiles for leaflet basemap
From SCECpedia
Contents
create new basemap for leaflet
goal: to create leaflet basemap overlay layer
georeference a png image file
Install QGIS from qgis.org
Run QGIS
Start a new project
first icon with a blank paper
load a map
Select XYZ Tiles and OpenStreetMap and zoom to region of interest
Load a png that needs to be geo-referenced
select Layer -> georeferencer
select open-raster and load the png file
Mark several map coordinates
select 'From Map Canvas' and mark the matching location at the background map(remember to click OK)
There will be a matching marker on the background map and georeferencer map
Georeference and Export a tif file
select georeferencing and exit
generate image tile set
Download gdal2tiles
pip install gdal2tiles
(also available from conda)
Depending on the resolution of the original png file and also the area that it covers, zoom level does not have to be higher than 10. (higher zoom equals to more required memory)
gdal2tiles.py -e --zoom=5-10 georeference_image.tif output_folder