Tiles: Mapbox.com Aerial
Example #35 - Displaying a USGS Topographic 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 USGS Topographic map downloaded from the USGS Web site.
This is the map for the Grand Canyon National Park in Arizona. Zoom in to see map details.
Take these steps if you want to try it yourself:
- Go to the USGS site and download the geoPDF for the Grand Canyon National Park. Currently the URL for these maps is: https://www.sciencebase.gov/catalog/item/5350540be4b0392a1406412b
- 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 file-name.pdf file-name.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" file-name.vrt file-name.tif
- Now you can run AltusRaster (AltusRaster -h will describe all of these options):
AltusRaster -i file-name.tif -of file-name_tiles -ml 12 -fa lanczos
When you run AltusRaster, note the dimensions of the bounding box and 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