PostGIS in Action
Where the adventure begins
Translate:

PostGIS in Action: Chapter 13 - PostGIS WKT Raster

Back to Chapter Listings

On MEAP

This chapter is about PostGIS WKT Raster and working with raster data in a PostGIS enabled database. PostGIS WKT Raster is a subproject of PostGIS and currently packaged as a separate install above PostGIS. It introduces a new PostgreSQL data type called raster that interoperates very nicely with the PostGIS geometry and geography types already present. You will be amazed at the many ways you can mix and match raster functions with geometry functions to develop simple plpgsql solutions.

In PostGIS 2.0, the plan is to integrate the two projects so that a PostGIS 2.0 db will contain Raster capability.

For PostGIS 1.3-1.5, WKT Raster is a separate .so/.dll file called rtpostgis. Linux/MacOSX users may need to compile their own, but for Windows users, we have experimental precompiled binaries for PostGIS 1.4/1.5 PostgreSQL 8.3/8.4 and the upcoming PostgreSQL 9.0 (now in beta 2).

For more information about the status of WKT Raster and its road map, check out WKT Raster Homepage.

A WKT Raster function reference is in progress as well with function list covering many of the functions already supported in PostGIS WKT Raster. Also check out the PostGIS WKT Raster FAQ in progress.

Be sure to check out the WKT Raster Roadmap, and of course if you are interested in helping funding the project via time or money so we can cover more, please do so.

Also check out tutorial 1 WKT Raster Tutorial 1 which covers ST_Intersects and ST_Intersection for raster/geometry combos.

The current draft of this chapter available on MEAP does not cover the new ST_Intersects and ST_Intersection functions, but the next draft will.

What is covered in this chapter

  • What is raster data and how is it different from vector data.
  • Exercise in loading raster data into PostGIS/WKT Raster enabled db and chopping up large rasters into smaller rasters during load.
  • Reading band values with SQL
  • Returning the extent of select Raster rows as a PostGIS geometry polygon
  • Georeferencing rasters
  • Polygonizing rasters based on pixel value ranges and bands.
  • Building custom plpgsql functions that leverage power of both raster and geometry functions.
  • Getting rasters that intersect a geometry and doing intersection operations with raster/geometry
  • Exporting PostGIS raster data type data to other raster file formats using GDAL PostGIS WKT Raster driver.
  • Warping (reprojecting) PostGIS raster data using gdalwarp and outputting to other raster formats
  • How to define PostGIS WKT Raster layers in MapServer
Buy PostGIS in Action direct from Manning Publications