Installation of program GDAL

  1. Download and run osgeo4w-setup-x86.exe or osgeo4w-setup-x86_64.exe for x64 on the link
  2. The program needs to be installed in standard mode ("Standard Desktop installation").

  3. In the second step select the site for downloading

  4. The package GDAL should be selected and set

  5. Run it in the mode "Advanced installation" again

  6. Than "Install from internet"

  7. Click "Next"

  8. At the stage of choosing a package, open a section "Libs"

  9. Locate the item "2.149k python-numpy: Python NumPy (Numerical) Extension" and switch it to "2.7-1.5.1-1" (in the new versions different name could be found)

  10. If there is an error in the program that does not suffice (Library MSVCR100.DLL, is not sufficient) then take the files MSVCR100.DLL, MSVCP100.DLL and copy them to a folder C:\WINDOWS\SYSTEM32

Solving the problems with the numbering tiles

The utility gdal2tiles by default creates an indexing under the standard OSGeo TMS (Tile Map Specification), for shaping tiles up to the standard Google OSM:

  1. Download the corrected script for right numbering of tiles (Google/OSM)

  2. Replace gdal2tiles in the folder С:\OSGeo4W64\bin\

Creating tiles (indexation)

The command of bonding of all rasters in the folder test

gdalbuildvrt test.vrt -vrtnodata "255 255 255" -hidenodata -resolution highest test/*.jpg

The command of transformation TIF of files in RGB (if there is another color model in files)

gdal_translate -of vrt -expand rgba test.tif test.vrt

Pay attention! File names must contain only latin characters. Files bindings of rasters must have the extensions tfw, jpw, sdw.

The command of transformation of raster in the coordinate system EPSG:4326

SK 63 - gdalwarp.exe -s_srs "+proj=tmerc +ellps=krass +lon_0=35d30E +lat_0=0d0N +k=1 +x_0=5300000 +y_0=-9214.69 +towgs84=+25,-141,-78.5,0.0,0.35,0.736,0.0" -t_srs EPSG:4326 -r bilinear test.vrt test.tif

EPSG:4326 - gdalwarp.exe -t_srs EPSG:4326 -r bilinear test.vrt test.tif (or you can skip this step)

The command of building tiles. The result will be stored in the folder test

gdal2tiles -p mercator --s_srs EPSG:4326 test.tif

Displaying tiles in Leaflet

For displaying tiles using the Leaflet:

TMS - L.tileLayer('http://{s}{foo}/{z}/{x}/{y}.png', {tms: true});

OSM - L.tileLayer('http://{s}{foo}/{z}/{x}/{y}.png', {});