2

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

JGW file:

                 0.1250000
                 0.0000000
                 0.0000000
                -0.1250000
           -584310.1875000
          -1213026.9375000

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...

Leaflet

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?

2
  • 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. May 18, 2018 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, 2018 at 2:26

1 Answer 1

0

On stackoverflow there is a Q&A which imports a georefered image (more precisely a jpg/jgw combination) directly in to leaflet.

But i think your main problem is that you do not get the jgw to edgecoordinates calculation right, which is explained here more precisly.

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.