Create Ground Control Points using NAIP & DEM

Here I will explain how to create Ground Control Points (GCP) by using NAIP and DEM.

As Ortho mosaicking software (e.g. TerraPhoto & PhotoScan) need GCP to accurately align the mosaic to true geographical co-ordinates. Often aerial imagery is captured over difficult to reach terrain. This makes collection of GPS’s less practical/feasible.

Solution: In lieu of actual GCP’s, I create ground control points using NAIP & DEM. Following are the steps for creating GCP’s:-

  • Download latest NAIP  & DEM from Geo Spatial Data Gateway. or any other source.
  • Mark down easily identifiable features on NAIP imagery in ArcMap, by creating new point shape file.
  • Export shape file as XY csv file in ArcCatalog.
  • Use csv file’s XY co-ordinates in Gdal’s command line executable to get the elevation for each pixel.
  • Now we can create new XYZ text file by joining columns of xy (shape file csv) and Z (output from gdallocationinfo)
    [spacer height=”20px”]

    gdallocationinfo elevation using DEM & xy shape file
    gdallocationinfo elevation using DEM & xy shape file
  • Import XYZ file into TerraPhoto/PhotoScan  and identify same features in all overlapping images. This will force XYZ coordinates from DEM & NAIP into the software solution.


KMZ Super Overlay

<p>KMZ superoverlay is a google earth file format, in which a bigger imageĀ is broken down into small tiles at each zoom level. This helps is fast rendering of image over google earth or online map server, as it just requests only the tiles displayed at certain zoom level.</p>
<p><strong>To create KMZ superoverlay you can use gdal_translate executable as follows:-</strong><br /> <em>”gdal_translate -of KMLSUPEROVERLAY -co FORMAT=png -ot Byte -scale -outsize 50% 50% inp.tif out.kmz”</em></p>
<p><strong>Command line options explained:-</strong><br /> -co FORMAT=png is the output format, it is important to choose png format as it creates transparent layer were there is no data.<br /> -outsize is optional, it just reduces the pixel resolution of KMZ file.<br /> -ot Byte is useful to convert floating point or 16 bit rasters to 8 bit.</p>

<a href=””><img class=”wp-image-1600 size-large” src=”″ alt=”KMZ SuperOverlay created from 32 bit floating point raster” width=”800″ height=”610″ /></a> KMZ SuperOverlay created from 32 bit floating point raster

Quickly Mosaic Tiles

To quickly create a mosaic from several tiles “gdalbuildvrt” & “gdal_translate” can be used as follows:-

  1. Create a virtual raster from all the tiles in a folder:- 
    Run the following command at DOS prompt of your system. Make sure you command line prompt is showing current path as you input tiffs. Then run the following command=> “gdalbuildvrt virtual_mosaic.vrt *.tif”  (any wild card pattern can be used to suite your needs). This will create a virtual mosaic of all the tiffs in the folder from where you executed the command.
  2. Create mosaic from virtual raster:-
    Execute the follwoing command at the command line=> “gdal_translate virtual_mosaic.vrt mosaic.tif”

Note: To make my (gdal command line executable) tasks much simpler, I copy all the gdal utilities (exe and dll) in ..windowssystem32 folder. This way I can execute Gdal commands from any folder without specifying full path to the executables, input and output files.

Convert Float 32 bit to 16 bit using gdal commander

I use PhotoMosaic (a module of PhotoMod) software for stitching and color balancing rectified images. And it doesn’t support images from FLIR camera, since they are in 32 bit (floating point) tiffs. Therefore I have to convert all 32 bit images to 16 bit format to be able to use them in Photomod.

I use “gdal_translate -ot Uint16 -scale -40 120 0 65535 inp.tif out.tif” to convert thermal images which had original temperature range of -40 to 120 C to 16bit digital number ranging from 0 to 65535.  In Gdal Batch Commander I will just enter the underlined part of the above command and select all images and execute the same command on all the selected images.

Gdal Batch Commander float to 16 bit

Once mosacing process is complete, I convert 16bit mosaic back to 32bit float pixel values by using “gdal_translate -ot Uint16 -scale 0 65535 -40 120 inp.tif out.tif” command.

Best thing about gdal is that even after converting the pixel values from float 32 to 16 bit, still maintains geographical location information. And I can just use simple command line switches and convert hundreds of rectified tiff in single Gdal Batch Commander run.