This repository contains a Python script to process FAA Visual Flight Rules (VFR) sectional chart ZIP files into MBTiles format for web mapping or GIS applications. The script automates unzipping, cropping, reprojection, and tile generation, producing compact MBTiles files (~20MB) with transparent no-data areas for seamless stitching in tools like QGIS.
- Input: FAA VFR chart ZIPs or unzipped folders from FAA Digital Products.
- Output: MBTiles files in EPSG:3857, zoom levels 10-13, WebP compression.
- Automation: Handles multiple charts, skips processed folders, resumes from intermediates.
- Transparency: Chart borders/legends are transformed to transparent for clean map overlays.
- Logging: Detailed progress in
vfr_processing.log.
- Operating System: Windows, macOS, or Linux.
- Python: 3.8 or higher.
- Conda: Miniconda or Anaconda.
- Git: For cloning the repository.
- Disk Space: ~100-200MB per chart (includes intermediates).
Clone this repository to your local machine:
git clone https://github.com/howl0893/vfr-map-processor.git
cd vfr-map-processorCreate and activate a Conda environment named vfr:
conda create -n vfr python=3.8
conda activate vfrInstall required packages using conda and pip. The script depends on GDAL with WebP support, along with other libraries.
conda install -c conda-forge gdal numpy scikit-image scipy matplotlib
pip install rasterioVerify GDAL supports WebP (required for MBTiles):
gdalinfo --formats | grep -i webp- Visit the FAA VFR Charts page.
- Scroll to the "Sectional Charts" section.
- Download ZIP files (e.g., Los_Angeles.zip, Las_Vegas.zip) by clicking the links.
- Place the ZIPs in the media/ directory (create it if needed):
mkdir media
mv ~/Downloads/Los_Angeles.zip media/
mv ~/Downloads/Las_Vegas.zip media/Alternatively, unzip the files manually and place the folders (e.g., media/Las_Vegas/) in media/.
conda activate vfr
python vfr_processing.pyThe script will:
Unzip ZIP files (skips if already unzipped).
Find .tif files (handles renamed TIFFs).
Process each chart into MBTiles, resuming from existing intermediates if available.
Log progress to vfr_processing.log.
The script processes each chart in three steps, preserving intermediate files for debugging or reuse.
Input: Original TIFF (e.g., Las Vegas SEC.tif).
Process: Crops the map to a polygon around the chart area, removing white borders, and saves as RGBA with transparent no-data areas.
Output: <name>-crop.tif (e.g., las_vegas-crop.tif).
Input: Cropped TIFF.
Process: Reprojects to EPSG:3857 (Web Mercator) for web mapping compatibility, preserving transparency.
Output: <name>-crop-3857.tif (e.g., las_vegas-crop-3857.tif).
Input: Reprojected TIFF.
Process: Converts to MBTiles with WebP compression (zoom 10-13, quality 20).
Output: <name>.mbtiles (e.g., las_vegas.mbtiles).





