wiki:UserDocs/RasterProcTutorial

Version 1 (modified by warmerdam, 17 years ago) ( diff )

--

Raster Processing Tutorial

This is a working copy of a tutorial to be presented at FOSS4G 2007 (L-01) that will hopefully also be useful as a web based tutorial in the future.

Objectives

A practical tutorial on processing and preparing raster data for visualization or futher analysis. Exercises will include:

  • Exploring your image data
  • Format translation
  • Optimizing data for MapServer/MapGuide/etc
  • Rescaling
  • Mosaicing
  • Reprojection
  • Using virtual files.

Most exercises will be performed using GDAL command line utility programs, with a final exercise demonstrating Python scripting for specialized processing. It is intended that the workshop would be useful for anyone needing to prepare raster data for use in packages such as MapServer, MapGuide, QGIS, GRASS, OSSIM or proprietary GIS and imaging applications.

Audience: Suitable for those new to GDAL. Some familiarity with geospatial raster data and coordinate systems is assumed but not strictly required.

System Requirements: FWTools for Windows or Linux

Datasets: Download from http://download.osgeo.org/gdal/workshop

Note to self, need to add geogratis and/or geobase license info on download site for cded and CanMatrix data.

Exploring Your Data

- Use gdalinfo to review several datasets. 
- Highlight:
   image size
   geotransform
   gcps
   coordinate system
   metadata
   band type
   block size
   nodata value
   color table

- Use OpenEV to view datasets. 
- Highlight: 
   finding exact location of a pixel (and subpixel position issues)
   Seeing pixel greyscale values (and for multiple bands)
   "see through" due nodata and alpha bands. 
   Overlay flipping

Perhaps also demonstrate something similar with QGIS? 

Simple Format Translation

Know your Drivers

The --formats commandline switch of gdal_translate can be used to see a list of available format drivers. Each format reports if it is read only (ro), read/write (rw) or read/write/update (rw+).

 gdal_translate --formats

2b) The --format commandline switch can be used to query details about a

particular driver, including creation options, and permitted data types.

gdalinfo --format jpeg gdal_translate --format png

-- Translation --

2c) Translations are accomplished with the gdal_translate command. The

default output format is GeoTIFF:

gdal_translate east.dem eastdem.tif

2d) The -of flag is used to select an output format and the -co flag is

used to specify a creation option:

gdal_translate -of JPEG -co QUALITY=40 world.png world.jpg

-- Output Datatype --

2e) The -ot switch can be used to alter the output data type.

gdal_translate -ot Byte east.dem bytedem.tif

2f) Use gdalinfo to verify data type, and OpenEV to observe that all

elevations have been clipped to 255.

-- Rescaling --

2g) The -scale switch can be used to rescale data.

gdal_translate -of JPEG -scale east.dem east.jpg

2h) Explicit control of the input and output ranges is also available,

and the gdalinfo -mm switch can be used to see pixel min/max values:

gdalinfo -mm east.dem gdal_translate -of JPEG -scale -100 678 0 255 east.dem east.jpg

Note: See TracWiki for help on using the wiki.