I have one JPG (170 MB) and JGW file of a small area projected in EPSG:5514 (Image provider told me.)

JGW file:


I am trying to create a custom map tiles for Leaflet in EPSG:3857.

I have tried to convert source JPG to TIFF

gdal_translate -of Gtiff -a_srs EPSG:5514 -co COMPRESS=JPEG -co JPEG_QUALITY=100 -co PHOTOMETRIC=YCBCR source.jpg output.tiff

Then I have used gdalwarp for reprojection

gdalwarp -of Gtiff -s_srs EPSG:5514 -t_srs EPSG:3857 -co COMPRESS=JPEG -co JPEG_QUALITY=100 -co PHOTOMETRIC=YCBCR output.tiff output_3857.tiff

Then I have transformed it to JPEG and changed the image size for zoom level

gdal_translate -of JPEG -outsize 16384 17700 output_3857.tiff output_zoom6.jpg

As a last step I generated the tiles

gdal2tiles -p raster -w all output_zoom6.jpg tiles

But if I use these tiles in Leaflet and I try to add a marker to the map, marker is in the wrong place...


Marker should be near the center of the image... If I use OpenStreet map tiles, marker is in the correct position, so my tiles are on the wrong place.

Any ideas what I am doing wrong?

  • It's difficult to see the offset with the information you've shown. Can you please change your screenshot, so it shows four markers where the four corners of the raster image would be? That'd help a bit more. – IvanSanchez May 18 '18 at 7:51
  • I think GDAL is not reading the info in jgw file. Use -projwin ulx uly lrx lry to give the coordinates of corner. – neogeomat May 27 '18 at 2:26

Your Answer

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

Browse other questions tagged or ask your own question.