Skip to content

Instantly share code, notes, and snippets.

@dbaldwin
Last active June 10, 2022 17:18
Show Gist options
  • Select an option

  • Save dbaldwin/fdae2fe9b83e03fcfa854815b0699dcb to your computer and use it in GitHub Desktop.

Select an option

Save dbaldwin/fdae2fe9b83e03fcfa854815b0699dcb to your computer and use it in GitHub Desktop.
Tiling an FAA sectional chart with GDAL and viewing it as a layer in Google Earth
# Dennis Baldwin
# March 29, 2019
# I've found the easiest and most consistent way to pull this off is with Docker and the following image
# https://github.com/geo-data/gdal-docker
# Change to your working directory and run the following Docker command
# The command below will map your current directory to a /data directory in the container
docker run -it -v $(pwd):/data geodata/gdal /bin/bash
# Go to the following URL in your browser and find your sectional chart of interest
# https://aeronav.faa.gov/content/aeronav/sectional_files/
# Since I'm most interested in Austin I'll right click and copy the San Antonio sectional chart url (where Austin is included)
# Issue the following command in your Docker container
wget 'https://aeronav.faa.gov/content/aeronav/sectional_files/San_Antonio_103.zip'
# Now that the file is downloaded be sure to unzip it
unzip San_Antonio_103.zip
# Let's use the gdal tools that are part of the container image and do the necessary conversion
# Expand the color table
gdal_translate -expand rgb 'San Antonio SEC 103.tif' 'San_Antonio_SEC_103_RGB.tif'
# Get projection info
gdalsrsinfo -o proj4 "San Antonio SEC 103.tif"
# Reproject for Google Earth
gdalwarp --config GDAL_CACHEMAX 1024 -wo NUM_THREADS=val/ALL_CPUS -wm 200 -multi -r bilinear -dstalpha -dstnodata 0 -s_srs '+proj=lcc +lat_1=30.66666666666667 +lat_2=25.33333333333333 +lat_0=30.125 +lon_0=-100 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs' -t_srs EPSG:3857 -of GTiff 'San_Antonio_SEC_103_RGB.tif' 'San_Antonio_SEC_103_RGB_warped2.tif'
https://github.com/OSGeo/gdal/blob/release/2.3/gdal/swig/python/scripts/gdal2tiles.py#L991
gdal2tiles.py -z 5-12 -k San_Antonio_SEC_103_RGB_warped2.tif ./tiled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment