Skip to content
Brian Manlove edited this page Aug 17, 2024 · 67 revisions

Welcome to the chartmaker wiki!

Chartmaker Process Control Files

chartdates.json

The FAA publishes charts 20 days before the official chart date, and chartmaker will automatically select the nearest chart date from this file of official FAA chart 56-day release dates, all the way up to the year 2044. If the next chart date is more than 20 days out, chartmaker will get the current chart date.

settings.json

  • Edit the values in chartprocessindexes with any ordinal index numbers from the faachartnames list for charts you want to process, in the order you want them processed. The default is all charts in the index list, in index order. The setting array faachartnames are the actual zip filenames the FAA uses and are for reference only. Changes to the downloadtemplate or faachartnames, layertypes, and tiledrivers lists is not recommended!
  • The zoom range value can either be in the format n-n, or you can use a single zoom level n
  • You can change the tileimagequality percentage from 1 up to 100 and tiledriverindex index to 2 (webp) to reduce mbtiles file size. The smaller the percentage, the fuzzier the chart will be at high zoom levels.
    • The tiledimagequality setting works for both png and webp images.
  • To save disk space, you can set cleanprocessfolders to true.
    • The merge and/or pngquant work folders will be many gigabytes for the entire chart set and are not needed once processing is complete
  • To preserve the processed databases, you can set renameworkarea to true. This will rename the workarea folder to include the processed chart date so the next run will not overwrite the folder.

settings.json values

  • attribution is a database metadata value that many mapping applications use for acknowledgement of the database creator*
"attribution": "Aviation charts <a href='https://github.com/n129bz/chartmaker'>github.com/n129bz/chartmaker</a>",   
  • curl download templates, values inside brackets <> are programmatically replaced with values to match FAA's file names*
"vfrdownloadtemplate": "https://aeronav.faa.gov/visual/<chartdate>/All_Files/<charttype>.zip",   
"ifrdownloadtemplate": "https://aeronav.faa.gov/enroute/<chartdate>/<charttype>.zip",
"vfrindividualtemplate": "https://aeronav.faa.gov/visual/<chartdate>/sectional-files/<charttype>.zip",    
  • application flags
"renameworkarea": false,       <- if true, will append chart date to the working folder name  
"logtofile": true,             <- if true will produce a file "debug.log"  
"cleanprocessfolders": false,  <- if true then working folders are removed after processing
  • tile image quality percentage, tileimagequality has a huge effect on png processing time, not quite as much with webp*
"tileimagequality" : 50,   <- percentage (1-100) greatly affects processing speed and database size
"zoomrange" : "1-12",      <- range of overviews to produce, higher takes longer and can make db huge
"dbfolder: "",             <- optional folder, if a valid path is used the app will put db files here, otherwise will use default
  • chartprocessindexes control which chart types to process. Each faachartname is an array with 3 values: FAA chart name, chart type, and an alias (not used for vfr charts.) The chartprocessindexes array values correspond to the ordinal position (zero-based) in the faachartnames list. Array entries can be reordered or omitted for specific chart(s) processing.
    Examples: [0,6] or [6,5,3]
    WARNING: Editing of any of the faachartnames values will break the application!*
"chartprocessindexes": [0,1,2,3,4,5,6], <- charts represented by indexes 0-5 will be processed, in this order   
"faachartnames": [   
    ["Sectional", "vfr", ""],   <- as in [FAA chart name, type, alias] (no alias used for vfr charts)
    ["Caribbean", "vfr", ""],
    ["Grand_Canyon", "vfr", ""],
    ["Terminal", "vfr", ""],         
    ["Helicopter", "vfr", ""],   
    ["DDECUS", "ifr", "Enroute_Low"],  <- aliases for DDECUS are required (Digital Data Enroute Continental US)
    ["DDECUS", "ifr", "Enroute_High"]
],
  • layertypeindex controls the layertype and therefore how it will be rendered on a map, for example If you will be overlaying an OSM map with your chartmaker map*
"layertypeindex": 1,   
"layertypes": [   
    "baselayer",    
    "overlay"   
],
  • tiledriverindex determines the tiledriver type, for example webp produces the smallest image size but png produces the sharpest images*
"tiledriverindex": 0,   
"tiledrivers": [   
    "png",   
    "jpg",   
    "webp"   
]

*Additional information

The chart zip files are downloaded from the FAA digital raster chart repository and unzipped. After the unzipping process all of the the resultant GEOtiff image names (and their matching tfw world file names) are "normalized" to all lower-case filenames with underscores in place of dashes and spaces and any apostrophes removed. This simplifies the down-stream processing of these files since GDAL can interpret spaces as argument separators.

Installing Required apps/libraries on a linux machine or WSL (ubuntu)

Install list: sqlite3, python3, Nodejs + npm, Perl, cpanminus, pngquant, imagemagick, curl, unzip, build-essential, libgdal-dev, and GDAL v3.6.2 (minimum)

Note: Most linux machines have Perl installed by default

Step 1. Apt Install

sudo \   
  apt install -y \
     sqlite3 \
     pngquant \
     imagemagick \
     curl \
     unzip \
     build-essential \
     libssl-dev \
     libgdal-dev \
     cpanminus \
     gdal-bin

Step 2. - Install node and npm NOTE: USE OF NVM HIGHLY RECOMMENDED as it will install both node and npm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

After this is done, we must re-source .bashrc to get nvm into the path environment variable, then install node: 
copy and paste it back into the prompt and hit enter, then:

source /root/.bashrc
nvm install --lts
nvm use --lts

Step 3. - Clone the repository (shown as cloned from the /home/user folder

cd /home/userid
git clone https://github.com/n129bz/chartmaker.git

Step 4. Set execute permissions on perlsetup.sh - In a terminal, navigate to your cloned instance of chartmaker

cd /home/userid/chartmaker
chmod +x perlsetup.sh

Step 5. - Run the script

./perlsetup.sh

*Note: This will install the following Perl utilities: 
strict
warnings
autodie
Carp
Modern::Perl
Params::Validate
File::Slurp
File::Copy

Installing on a docker image

Step 1. - Pull debian 12 docker image

docker pull debian:stable-slim

Step 2. - get the Image ID

docker images

Make note of the 12 character Image ID as listed for the debian image

Step 3. - Launch a container that uses this image in an interactive terminal

docker run -it <imageid>

Step 4. - Install all required programs

apt install -y \   
     sqlite3 \   
     pngquant \        
     imagemagick \         
     curl \         
     unzip \         
     build-essential \    
     libgdal-dev \ 
     libssl-dev \
     cpanminus \        
     gdal-bin \   
     git

Step 5. - install node and npm NOTE: USE OF NVM HIGHLY RECOMMENDED as it will install both node and npm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

After this is done, re-source .bashrc to add nvm to the path, then install the long-term-support version of node:
source /root/.bashrc
nvm install --lts
nvm use --lts

Step 6. - clone the repository into the base folder**

cd /
git clone https://github.com/n129bz/chartmaker.git
cd chartmaker

Step 7. (Optional) - install and use your favorite text editor (nano shown) and edit the settings.json file to select which chart(s) to process

apt install nano

nano /chartmaker/settings.json

Step 8. MOST IMPORTANT STEP - commit the docker container to persist it as a new image
NOTE: See https://ktomk.github.io/pipelines/doc/DOCKER-NAME-TAG.html

Enter docker ps -a to list all containers. Make note of the container
being used and copy the container ID (not an image ID) and enter:

docker commit <containerid> <your desired image name>

Step 9. After committing the new container, get the new image id:

docker images

Step 10. Run the application in a new container

docker run -it <new image id>

When the terminal prompt is ready, 
cd /chartmaker   
npm install   
node make    

Optional Step 11. You can create a new image using a dockerfile. The following examples show how you could build a new image from n129bz/chartmaker:v1.35 and then run the application, processing all 53 area charts, and having those chart db's placed in a local folder:

#dockerfile
FROM n129bz/chartmaker:v1.35
ENV PATH="$PATH:/root/.nvm/versions/node/v20.16.0/bin"
WORKDIR /chartmaker
CMD ["node", "make", "*"]

Build the new image from the dockerfile:

docker build -t mynewchartmakerimage

Launch the new image non-interactive (no -it switch), using the volume (-v) switch to specify a local folder that will receive all of the db files. This example requires that you edited settings.json key dbfolder with the value localfolder. Docker will mount the local folder into the chartmaker folder on the container:

docker run -v /mylocalfolder/dbfolder:/chartmaker/localfolder mynewchartmakerimage 

Optional Step 12. If you want to save this new image as an archive file
NOTE: See https://docs.docker.com/reference/cli/docker/image/save/

NOTE: docker will save the file as a .tar archive
docker save -o <your file name>.tar <new image id> 

TO LOAD saved your image archive directly into docker,
docker load --input <your saved image archive name>.tar

Clone this wiki locally