Changes between Version 8 and Version 9 of UsersWikiCoveragesAndPostgis


Ignore:
Timestamp:
Jul 22, 2011, 12:51:10 PM (11 years ago)
Author:
bnordgren
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiCoveragesAndPostgis

    v8 v9  
    4343Two main types of discrete coverages, in the common parlance, are "vector" and "raster". These are not distinctions present in ISO 19123, which has served as the basis of this document up to this point. We introduce the notions of vector and raster simply because the terms have a notional value, and we wish to place them in context with respect to a larger framework.
    4444
    45 === Vector Coverages ===
     45=== Vector Coverages backed by tables ===
    4646
    47 Vector coverages are probably the most familiar type of coverage to the majority of users. The collection of data items upon which the coverage is based is usually a table. Individual data items are individual rows in the table. The columns of the table ensure that the collection is self-consistent. Each data item (row) may fill in values for each column: text may be placed in text columns, numbers in numeric columns, geometries in geometry columns, etc. The only requirement a table must fulfill in order to have the potential to supply information to a coverage is that it must have at least one `geometry` column and one additional column to use for a value (which may be of any type, including `geometry`).
     47Vector coverages backed by tables are probably the most familiar type of coverage to the majority of users. These have been available to users since the first version of PostGIS. Individual data items are individual rows in the table. The columns of the table ensure that the collection is self-consistent. Each data item (row) may fill in values for each column: text may be placed in text columns, numbers in numeric columns, geometries in geometry columns, etc. The only requirement a table must fulfill in order to have the potential to supply information to a coverage is that it must have at least one `geometry` column and one additional column to use for a value (which may be of any type, including `geometry`).
    4848
    4949The following table could serve as a collection of data items upon which a coverage could be built. Note that it has a `geometry` column (geom), two text columns (Name and Mayor), and two numeric columns (Elevation and Population). Each row is a data item, and each relates a point to a consistent set of values, defined by the columns. For display purposes, the "geom" column shows a point where the city belongs.
     
    7676
    7777Clearly, a table with a raster column could be used as an index into many unrelated rasters. This is a legitimate use of the table facility. However, it is an example of a table which could not be used to provide information to a "raster coverage."
     78
     79=== Vector coverages backed by a geomval collection ===
     80
     81With the advent of PostGIS raster, a new datatype was introduced: the `geomval`. This name stands for "geometry-value", and pairs a single geometry object with a single value. Using this type is another way to associate locations with values, which is the single requirement for data which backs a coverage.
     82
     83The collection of `geomval` elements is analogous to a table having one `geometry` column and one value column capable of containing numeric data. (The type may be enhanced in the future to include more than one numeric value.) Each element in the collection is analogous to a single row of the table.
     84
     85The `geomval` type was originally introduced to represent a "vectorized" raster. That is, using the function [http://postgis.refractions.net/documentation/manual-svn/RT_ST_DumpAsPolygons.html ST_DumpAsPolygons()], you can obtain a set of `geomval`s, each of which relates a polygon to a particular value. The polygon "outlines" all of the pixels which possess the indicated value. Alternatively, you can request specific values to be returned. After a raster has been "vectorized" in this way, the geometries may participate in the normal spatial operations (intersection, difference, etc.) with other geometries. This enables mixed raster and geometry operations which return geometries, and the computation is actually performed using two geometries.
     86
     87As this process can be rather slow if a large number of pixels are "vectorized", the user should take care to minimize the number of pixels which require this treatment.
     88
     89== Summary ==
     90
     91This page attempts to present some of the new capabilities added by PostGIS Raster, relevant to how data are represented inside PostGIS.  Two new datatypes have been introduced: `raster` and `geomval`.
     92
     93A table containing a `raster` column must be treated with care in order to ensure that the desired effect is achieved. A single image may be split over multiple rows, and later re-aggregated into a single unit. To aggregate a single "raster coverage" from the rows in such a table, the user must ensure that all of the rows participating in the aggregation have the same number of bands and the same data type. This is clearly the case when a single image produces all of the rows, but may not be the case if other data were subsequently inserted. Columns which do not have the `raster` type may be used to identify the original image (coverage) for the purposes of selecting which rows participate in the aggregation. If the user has no intention of aggregating individual rows into a larger product (or performing an operation on a set of rows as if they were a single logical item--e.g., an image), then none of these restrictions need apply.
     94
     95The `geomval` type is an alternative way to store data for a vector coverage with numeric values. Originally used as a means of representing a "vectorized" raster, it contains the same information as the source raster; but in a different form.