I working on a project need to tackle with deal with geotiff image file.
I'm new to leaflet and geotiff image.I got an image from client and i need to overlay it to leaflet map from geotiff. I used
gdal2tiles.py -p raster [image.tif]
to generater tiles map. And i tried to display it on leafletmap, however I got this display
I wondering anyone have idea to figure out, how to find out the optimal zoom level for convertion from geotiff to raster files without lossing it's quality?Here is my gdalinfo from my geotiff file.
Driver: GTiff/GeoTIFF Files: Geotiff.tif Size is 25070, 18673 Coordinate System is: PROJCS["WGS 84 / UTM zone 54N", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",141], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","32654"]] Origin = (297884.090830000001006,3955249.192560000345111) Pixel Size = (0.071710000000000,-0.071710000000000) Metadata: AREA_OR_POINT=Area TIFFTAG_SOFTWARE=pix4dmapper Image Structure Metadata: COMPRESSION=LZW INTERLEAVE=BAND Corner Coordinates: Upper Left ( 297884.091, 3955249.193) (138d45'55.76"E, 35d43'13.77"N) Lower Left ( 297884.091, 3953910.152) (138d45'56.97"E, 35d42'30.34"N) Upper Right ( 299681.861, 3955249.193) (138d47' 7.26"E, 35d43'15.09"N) Lower Right ( 299681.861, 3953910.152) (138d47' 8.46"E, 35d42'31.66"N) Center ( 298782.976, 3954579.672) (138d46'32.11"E, 35d42'52.71"N) Band 1 Block=25070x1 Type=Float32, ColorInterp=Gray NoData Value=-10000
Best Answer
I had a case like this, went through gdal2tiles.py source for inspiration and wrote this Python script:
In your case you'd call
and it should return deepest zoom level that still makes sense to tile at.
Note: This is meant to work for imagery not too far from the Equator and WGS 84 coordinate system. You may want to tweak it if your imagery is closer to poles.
Edit: My GeoTIFF unit was degree, so this code assumes unit is a degree. Your unit is meter, you'll have to tweak it for that, too.