Book Image

PostGIS Cookbook

Book Image

PostGIS Cookbook

Overview of this book

Table of Contents (18 chapters)
PostGIS Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Processing and loading rasters with GDAL VRT


Though PostGIS has plenty of functions for working with rasters, it is sometimes more convenient and more efficient to work on the source rasters before importing them into the database. One of the times when working with rasters outside the database is more efficient is when the raster contains subdatasets, typically found in HDF4, HDF5, and NetCDF files.

Getting ready

In this recipe, we will preprocess a MODIS raster with the GDAL VRT format to filter and rearrange the subdatasets. Internally, a VRT file is comprised of XML tags. This means we can create a VRT file with any text editor. But, since creating a VRT file manually can be tedious, we will use the gdalbuildvrt utility.

The MODIS raster we use is provided by NASA and available at

http://e4ftl01.cr.usgs.gov/MOLA/MYD09A1.005/2012.06.09/MYD09A1.A2012161.h08v05.005.2012170065756.hdf.

You will need GDAL built with HDF4 support to continue with this recipe as MODIS rasters are usually in the...