I've included more information and the scripts that were used to generate the output.
Example results can be found here at the links below and are all generated from the same original GeoTIFF. Each link brings you to the same zoom level and lat/lng in the map. The only difference on the input files is that is that on one of them I slice off all data left of the 180, the other one the map is left complete. The html files are set to the same example point and zoom level to show how that without slicing the file, the image quality is very poor. The one thing I notice is that if I include the 180 meridian, the number of tiles generated is far larger (46k vs 8k).
Bad Results: http://halo3.net/alaska_tiles_no_slice/leaflet.html
Good Results: http://halo3.net/alaska_tiles_sliced_at_180/leaflet.html
Here are the commands I use to generate both tile sets. It will automatically download, unzip and process the input file I am using producing the same results shown at the links above.
How might I be able to get the issue resolved?
I'm still quite a novice at GIS.
#!/bin/bash
wget -SN https://aeronav.faa.gov/content/aeronav/Planning/AK_WallPlan_2.zip && unzip -xo AK_WallPlan_2.zip
mv "Alaska Wall Planning Chart 2.tif" Alaska_Wall_Planning_Chart_2.tif
gdal_translate -expand rgb -strict -co TILED=YES -co COMPRESS=LZW -co BIGTIFF=YES Alaska_Wall_Planning_Chart_2.tif alaska_expanded_rgb.vrt
gdalwarp -t_srs EPSG:3857 -r lanczos -overwrite -multi -wo NUM_THREADS=ALL_CPUS -wm 1024 --config GDAL_CACHEMAX 1024 -co TILED=YES alaska_expanded_rgb.vrt alaska_warped.vrt
gdalwarp -t_srs EPSG:3857 -te -19979999 6016546 -13438444 11497579 -r lanczos -overwrite -multi -wo NUM_THREADS=ALL_CPUS -wm 1024 --config GDAL_CACHEMAX 1024 -co TILED=YES alaska_expanded_rgb.vrt alaska_warped_sliced_at_180.vrt
rm -rf alaska_tiles_no_slice
rm -rf alaska_tiles_sliced_at_180
gdalinfo alaska_warped.vrt
time gdal2tiles.py -vvv -z 0-9 --processes=16 -r lanczos -w leaflet alaska_warped.vrt alaska_tiles_no_slice
gdalinfo alaska_warped_sliced_at_180.vrt
time gdal2tiles.py -vvv -z 0-9 --processes=16 -r lanczos -w leaflet alaska_warped_sliced_at_180.vrt alaska_tiles_sliced_at_180
ORIGINAL Post:
I am trying to create a tileset from the following GeoTIFF file.
http://aeronav.faa.gov/content/aeronav/Planning/AK_WallPlan_2.zip
This is an aeronautical chart from the FAA. My issue seems to be that this specific image file does cross the 180th Meridian. This is causing some problems when trying to do the conversion. I'm not sure exactly why, but the resulting tiles have very poor image quality.
However, if I slice off the image at 180, then it will translate just fine.
Here are the commands I'm using:
gdal_translate -co TILED=TRUE -co COMPRESS=LZW -co BIGTIFF=YES -expand rgba alaska.tif alaska_output.tif
rm alaska_output_translated_slice_at_180.tif
gdalwarp -r lanczos -co LONG_CENTER=90 -s_srs 'PROJCRS["Lambert_Conformal_Conic", BASEGEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4326]], CONVERSION["Lambert Conic Conformal (2SP)", METHOD["Lambert Conic Conformal (2SP)", ID["EPSG",9802]], PARAMETER["Latitude of false origin",60.00305, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8821]], PARAMETER["Longitude of false origin",-141, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8822]], PARAMETER["Latitude of 1st standard parallel",45, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8823]], PARAMETER["Latitude of 2nd standard parallel",65, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8824]], PARAMETER["Easting at false origin",0, LENGTHUNIT["metre",1], ID["EPSG",8826]], PARAMETER["Northing at false origin",0, LENGTHUNIT["metre",1], ID["EPSG",8827]]], CS[Cartesian,2], AXIS["easting",east, ORDER[1], LENGTHUNIT["metre",1, ID["EPSG",9001]]], AXIS["northing",north, ORDER[2], LENGTHUNIT["metre",1, ID["EPSG",9001]]]]' -t_srs EPSG:3857 -te -19497422 6016546 -13438444 11497579 alaska_output.tif alaska_output_translated_slice_at_180.tif
gdal2tiles.py -z 0-9 --processes=16 -r lanczos -w leaflet -v alaska_output_translated_slice_at_180.tif
rm alaska_output_translated.tif
gdalwarp -r lanczos -co LONG_CENTER=90 -s_srs 'PROJCRS["Lambert_Conformal_Conic", BASEGEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4326]], CONVERSION["Lambert Conic Conformal (2SP)", METHOD["Lambert Conic Conformal (2SP)", ID["EPSG",9802]], PARAMETER["Latitude of false origin",60.00305, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8821]], PARAMETER["Longitude of false origin",-141, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8822]], PARAMETER["Latitude of 1st standard parallel",45, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8823]], PARAMETER["Latitude of 2nd standard parallel",65, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8824]], PARAMETER["Easting at false origin",0, LENGTHUNIT["metre",1], ID["EPSG",8826]], PARAMETER["Northing at false origin",0, LENGTHUNIT["metre",1], ID["EPSG",8827]]], CS[Cartesian,2], AXIS["easting",east, ORDER[1], LENGTHUNIT["metre",1, ID["EPSG",9001]]], AXIS["northing",north, ORDER[2], LENGTHUNIT["metre",1, ID["EPSG",9001]]]]' -t_srs EPSG:3857 alaska_output.tif alaska_output_translated.tif
gdal2tiles.py -z 0-9 --processes=16 -r lanczos -w leaflet -v alaska_output_translated.tif