Create Georeference PDF files for Avenza’s PDF Maps app

I have been using QGIS to geo-refeence maps in preperation for a new SOTA association. More on that later but the tool is a powerfull one and worthy of closer investigation.

Have PDF Maps Android on iPad and Android tablet. This app allows you to navigate using the tables GPS and overlay on a georeference PDF.

So the idea is to use base information to create custom map of the areas around and access to SOTA summits using a table with GPS to assist with navigation.

THIS IS NOT A PROCES TO REPLACE A GPS OR AN EXCUSE FOR NOT CARRYING A BACKUP MAP. It is a process that allow you to create a custom map and dispay on your favourite device .

I intend to use to provide a overview of a new area.

FYBOView

LocalArea 

Keep that in in mind there are a  lot of maps are available in geopdf format , both free and nominally priced in the Avenza store. It will be cheaper to just buy some maps and there are free overviews available for VK3 national parks from parks Victoria.

But, I have a few maps that I have notated with trails that are not georeferenced that I’d like to use. But for those cases when the map you want isn’t georeferenced.

GeoPDFis a unique data format that brings the portability of PDF to geospatial data. A GeoPDF document can present raster and vector data and preserve the georeference information. While GeoPDF is a proprietary format, we have a close alternative in the open Geospatial PDF format. GDAL has added support for creating Geospatial PDF documents from version 1.10 onwards.

Assuming you have installed QGIS. If not follow QGIS install instructions  

Creating the PDF file

Prepare the image.

Several ways. Depends on your site and available tools;

Use Garmin BaseCamp to create a map and use the print process to open in preview then save as a TIF file. 

or use Forest Explorer for Victoria (VK3) maps.

Create georeference data.

Open Qgis, select Plugins -> Manage and Install Plugins… Make sure that gdal and georeference plugin are checked. Select Raster -> Georeferencer -> Georeferencer In the Georeferencer select File -> Open Raster and open your tiff file. It will ask what CRS or coordinate system to use. This is the coordinate system in which you will be selecting georeferencing points.

Whilst will print the map with UTM coordinates overlayed I will use landmarks and lookup a lat/lng useing: GDQ (EPSG:4283)Set Basecamp preferences to Lat / Long ( dd mm ss.ss) and Datum to WGA-84

Now, you want to find points in this image that you can assign a coordinate to. If your image has grid lines, it’s easy. Use SOTA peaks or other major landmarks such road intersections. Find these same landmarks in Google Maps or Google Earth. Mathematically, you’ll need a minimum of 2 points spread both horizontally and vertically. I use six. One in each corned and usually two SOTA peaks.

For each of these points, use the ‘Add Point’ tool* to select your landmark and enter the coordinates.

* One of the buttons on the top has two intersecting lines and a yellow star, that’s ‘Add Point’

The Qgis georeferencer is supposed to be able to create the geopdf, but PDF Maps just says its an incompatible file. Instead, there’s a button that will give you the command-line switches to apply the georeference data with. We will use this information manually.

Select Settings -> Transformation Settings –

  1. Transformation Type: Polynomial 1, 2, or 3 (I haven’t experimented with this, but aparently effects accuracy of highly distorted maps.
  2. Resampling Method: Lanczos (This is supposed to be the best but takes longer to compute, I haven’t noticed a difference)
  3. Output Raster: output file name (required by the software, but we won’t use it)

Target SRS: output coordinate system (again, required by the software, but we won’t use it)

Select File -> Start Georeferencing… This will update the table on the bottom. The residuals will tell you how much in agreement the coordinate are in. This should be 1 few pixels or less. If not, there is someting wrong with the points entered earlier.

If all looks good, select File -> Generate GDAL script. Copy this script to a text editor.

Georeference our image.

Now it’s time to build the command line that will create the file that you need. To apply the coordinates, copy and paste all of the “-gcp x_pixel y_pixel x_coord y_coord” values into thetag below and run on your command line:

The command is;

>> gdal_translate -of GTiff -co “PROFILE=GeoTIFF”file1.tiff file2.tiff

and the GDAL script contents are;

gdal_translate -of GTiff -gcp 744.396 464.369 144.01 -37.691 -gcp 82.9136 96.7649 143.88 -37.6279 -gcp 1236.41 115.708 144.106 -37.6307 -gcp 1268.16 970.721 144.112 -37.7784 -gcp 239.069 745.448 143.911 -37.7397 “/Volumes/Data/maps/PDF SOTA/LocalArea.jpg” “/var/folders/h4/m6pmtkcn0mv7tlxp39jcxkwr0000gn/T/LocalArea.jpg”
gdalwarp -r lanczos -order 1 -co COMPRESS=NONE “/var/folders/h4/m6pmtkcn0mv7tlxp39jcxkwr0000gn/T/LocalArea.jpg” “/Volumes/Data/maps/PDF SOTA/LocalArea.tif”

so the command becomes;

>> /Library/Frameworks/GDAL.framework/Programs/gdal_translate -of GTiff -co “PROFILE=GeoTIFF” -gcp 744.396 464.369 144.01 -37.691 -gcp 82.9136 96.7649 143.88 -37.6279 -gcp 1236.41 115.708 144.106 -37.6307 -gcp 1268.16 970.721 144.112 -37.7784 -gcp 239.069 745.448 143.911 -37.7397 LocalArea.tif file2.tif

Now its time to apply all of the geolocation data, using the same EPSG number as was used during georeferencing. In this case as we are using WGA-84 it is EPSG:4326;

>> /Library/Frameworks/GDAL.framework/Programs/gdalwarp -t_srs EPSG:4326 -r lanczos -co “PROFILE=GeoTIFF” file2.tif file3.tif

So now you have a gereferenced TIFF file. We want to convert the TIFF file to a pdf so;

>> /Library/Frameworks/GDAL.framework/Programs/gdal_translate -of PDF file3.tif georeferenced.pdf

So lets go over again;

allen:PDF SOTA allen$ /Library/Frameworks/GDAL.framework/Programs/gdal_translate -of GTiff -co “PROFILE=GeoTIFF” -gcp 741.478 1080.39 146.061 -36.8556 -gcp 1048.45 1172.42 146.093 -36.8611 -gcp 1061.06 121.024 146.094 -36.7719 -gcp 1552.72 2274.25 146.142 -36.9572 -gcp 115.555 1930.09 146.001 -36.9278 06062016-1.tiff file2.tif

Input file size is 1905, 2375

0…10…20…30…40…50…60…70…80…90…100 – done.

 

allen:PDF SOTA allen$ /Library/Frameworks/GDAL.framework/Programs/gdalwarp -t_srs EPSG:4326 -r lanczos -co “PROFILE=GeoTIFF” file2.tif file3.tif

Creating output file that is 2063P x 2260L.

Processing input file file2.tif.

0…10…20…30…40…50…60…70…80…90…100 – done.

 

allen:PDF SOTA allen$ /Library/Frameworks/GDAL.framework/Programs/gdal_translate -of PDF file3.tif georeferenced.pdf

Input file size is 2063, 2260

0…10…20…30…40…50…60…70…80…90…100 – done.

 

 

Links

http://www.expeditionportal.com/forum/threads/137086-Create-Georeference-PDF-files-for-Avenza-s-PDF-Maps-app

http://www.spatialthoughts.com/blog/gis/geopdf-gdal/

http://www.gdal.org/frmt_pdf.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: