Tiles: Mapbox.com Aerial
Example #34 - Displaying a National Park Service map in the BA3 Altus Mapping Engine
It is easy to download GeoTiffs and GeoPDFs from the web and display them on the sphere in Altus.
This example demonstrates how to do it with a National Park Service map downloaded from the NPS's Web site.
This is the chart for the Grand Canyon National Park in Colorado. If you zoom in, the clarity is gorgeous,
and the registration is perfect with ground features.
Take these steps if you want to try it yourself:
- Go to the National Park Service site and download the geoPDF for the Grand Canyon National Park. Currently the URL for these maps is: https://www.nps.gov/hfc/cfm/carto-atoz-geopdf.cfm
- Find yourself a Linux machine. If you are creating it yourself, the latest version of Ubuntu is easy to install, and will even run from a USB drive or a CD if you do not want to dedicate a machine to Linux. Any CentOS7 compatible flavor of Linux is fine.
- Install GDAL on your Linux machine if it is not already there (if the command gdalinfo will not run, then you don't have gdal). Type something like "install gdal ubuntu" into a search engine to get instructions.
- Install AltusRaster on your machine. AltusRaster will be used to convert the geo-tiff into a form that Altus can use. You can download AltusRaster by: a) going to http://builds.ba3.us, b) click on the latest build, c) download the binary RPMs for CentOS7. If you type "install an rpm on ubuntu" into a search engine, you will find that it takes just a couple of commands to install AltusRaster.
- The geoPDF needs to be converted over to RGBA color space. You can run this command to produce the file in the needed format:
gdal_translate -of vrt -b 1 -b 2 -b 3 -b mask GRCAmap1.pdf GRCAmap1.pdf_RGBA.vrt
This means: make me a text file that redefines this image as coming from the pdf's bands 1 through 3, but making the fourth band just be a mask. This will convert the map. Change the name for whatever map you want to convert.
- Now reproject that with gdal warp into non-clyndrical projection - here we are converting it to spherical mercator:
gdalwarp -t_srs EPSG:3857 -of GTiff -co "TILED=YES" -co "TFW=YES" GRCAmap1.pdf_RGBA.vrt GRCAmap1.tif
- Now you can run AltusRaster (AltusRaster -h will describe all of these options):
AltusRaster -i GRCAmap1.tif -of GRCAmap1_tiles -ml 12 -fa lanczos
When you run AltusRaster, note the coordinates of the map's bounding box so you can use them in the code.
- Copy the tiles directory to a web server. Now they are available for downloading to an Altus app or web application, as demoinstrated in this example.
Maps: © Mapbox © OpenStreetMap