Data Processing - Raster Ops

PostGIS raster's goal is to implement the raster type as much as possible like the geometry type is implemented in PostGIS and to offer a single set of overlay SQL functions (such as ST_Intersects) operating seamlessly on vector and raster coverages.

Each raster or raster tile is stored as a row of data in a PostgreSQL database table. It is a complex type, embedding information about the raster itself (width, height, number of bands, pixel type for each band, and no data value for each band) along with its geolocalization (pixel size, upper left pixel center, rotation, and SRID). These metadata are accessible by raster_columns view.

Something that shows flexibility of PostGIS raster support is in-db / out-db raster tile storage. Operations on these are identical, no matter if the raster is stored internally in PostgreSQL or file in filesystem. The only drawback is query processing time for out-db raster coverages.

PostGIS Raster is expressed in different forms, depending on the level at which it is referred:

  • WKT: Well Known Text refers to the human readable text format used when inserting a raster with ST_RasterFromText() and retrieving a raster with ST_AsText() (these two are not implemented yet). This format can result in the loss of precision when used with floating point values. This is why the HEXWKB form is preferred when importing/exporting in textual form.
  • WKB: Well Known Binary refers to the binary equivalent of the WKT. It is used when inserting a raster using ST_RasterFromWKB() and retrieving a raster using ST_AsBinary().
  • HEXWKB: Hexadecimal WKB is an exact hexadecimal representation of the WKB form. It is also called the canonical form. It is what you get from the loader (raster2pgsql), what is accepted by the raster type input function (ST_Raster_In), and what you get when outputting the value of a raster field without conversion (for example, SELECT rast FROM table).
  • Serialized: The serialized format is what is written to the filesystem by the database. It differs from WKB in that it does not have to store the endianness of the data and that it must be aligned. Serializing is the action of writing data to the database file, deserializing is the action of reading this data.

As a convention similar to geometry columns (column named geom), the rast column is used for storing raster datatype. The result of raster conversion functions maybe returned as the function name; it's our role to set it with AS keyword.

There are a variety of PostGIS raster functions especially created for raster analysis and processing. We can divide them into some groups:

  • Raster table management
  • Raster constructors
  • Dataset accessors and editors
  • Band accessors and editors
  • Pixel accessors and editors
  • Raster geometry editors
  • Outputs
  • Processing tools
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset