From: Regina Obe Date: Wed, 1 Jun 2011 08:17:27 +0000 (+0000) Subject: move raster types to raster section (there are way too many now to try to lump into... X-Git-Tag: 2.0.0alpha1~1510 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4dc001d10ad2af6c08d06165c5710c7c511513a3;p=postgis move raster types to raster section (there are way too many now to try to lump into reference_type and do case statements to exclude from postgis_comments). Revise raster_comments to look for types in reference_raster. Add docu for ST_Reclass and reclassarg type. Need at least one more example to show how to use recalssargs. git-svn-id: http://svn.osgeo.org/postgis/trunk@7304 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 04ddc19ae..59aa63c83 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -259,6 +259,109 @@ VALUES (1, '41000000007719564100000000000000000000000000000000FFFFFFFF050005000400FDFEFDFEFEFDFEFEFDF9FAFEF' || 'EFCF9FBFDFEFEFDFCFAFEFEFE04004E627AADD16076B4F9FE6370A9F5FE59637AB0E54F58617087040046566487A1506CA2E3FA5A6CAFFBFE4D566DA4CB3E454C5665')::raster); + + + Raster Support Data types + + + This section lists the PostgreSQL data types specifically created to support raster functionality. + + + + + + geomval + A spatial datatype with two fields - geom (holding a geometry object) + and val (holding a double precision pixel value from a raster band) + + + + Description + geomval is a compound data type consisting of a geometry object referenced by the .geom field + and val, a double precision value that represents the pixel value at a particular geometric location in a raster band. + It is used by the ST_DumpAsPolygon and Raster intersection family of functions as an output type to explode a raster band into + geometry polygons. + + + See Also + + + + + + + raster + raster spatial data type. + + + + Description + raster is a spatial data type used to represent raster data such as those imported from jpegs, tiffs, pngs, digital elevation models. + Each raster has 1 or more bands each having a set of pixel values. Rasters can be georeferenced. + + Requires PostGIS be compiled with GDAL support. Currently rasters can be implicitly converted to geometry type, but the conversion returns the + of the raster. This auto casting may be removed in the near future so don't rely on it. + + + + + Casting Behavior + This section lists the automatic as well as explicit casts allowed for this data type + + + + + Cast To + Behavior + + + geometry + automatic + + + + + + + + See Also + + + + + + + reclassarg + A composite type used as input into the ST_Reclass function defining the behavior of reclassification. + + + Description + A composite type used as input into the ST_Reclass function defining the behavior of reclassification. + + + nbandinteger + The band number. + + + reclassexprtext + Mathemetical expression defining how to map band to new band. + + + pixeltypetext + One of defined pixel types as described in + + + + + Example: Reclassify band 2 as an 8BUI where 255 is nodata value + SELECT ROW(2, '0-100:1-10, 101-500:11-150,501 - 10000: 151-254', '8BUI', 255)::reclassarg; + + + See Also + + + + Raster Management Functions @@ -4384,6 +4487,84 @@ POLYGON((3427928 5793243.85,3427928 5793243.8,3427928 5793243.75,3427927.85 5793 , + + + + ST_Reclass + Creates a new raster composed of band types reclassified from original. The nband is the band to be changed. If nband is not specified assumed to be 1. All other bands are returned unchanged. + Use case: convert a 16BUI band to a 2 8BUI and so forth for simpler rendering as viewable formats. + + + + + + raster ST_Reclass + raster rast + integer nband + text reclassexpr + text pixeltype + double precision nodataval=NULL + + + + raster ST_Reclass + raster rast + reclassarg[] VARIADIC reclassargset + + + + raster ST_Reclass + raster rast + text reclassexpr + text pixeltype + + + + + + Description + + Creates a new one band raster formed by applying a valid PostgreSQL algebraic operation defined by the expression on the input raster (rast). If no band is specified + band 1 is assumed. The new raster will have the same georeference, width, and height as the original raster but will only have one band. + + The bands of the new raster will have pixel type of pixeltype. If reclassargset is passed in then each reclassarg defines behavior of each band generated. + + + Availability: 2.0.0 + + + + Examples + + Create a new raster from the original where band 2 is converted from 8BUI to 4BUI and all values from 251-255 are set to nodata value. + ALTER TABLE dummy_rast ADD COLUMN reclass_rast raster; +UPDATE dummy_rast SET reclass_rast = ST_Reclass(rast,2,'0-100:1-10, 11-90:11-15, 91-254:0-0', '4BUI',0) WHERE rid = 2; + +SELECT i as row, j as col, ST_Value(rast,2,i,j) As origval, + ST_Value(reclass_rast, 2, i, j) As reclassval, + ST_Value(reclass_rast, 2, i, j, false) As reclassval_include_nodata +FROM dummy_rast CROSS JOIN generate_series(1, 3) AS i CROSS JOIN generate_series(1,3) AS j +WHERE rid = 2; + + row | col | origval | reclassval | reclassval_include_nodata +-----+-----+---------+------------+--------------------------- + 1 | 1 | 78 | 8 | 8 + 2 | 1 | 98 | 10 | 10 + 3 | 1 | 122 | | 0 + 1 | 2 | 96 | 10 | 10 + 2 | 2 | 118 | | 0 + 3 | 2 | 180 | | 0 + 1 | 3 | 99 | 10 | 10 + 2 | 3 | 112 | | 0 + 3 | 3 | 169 | | 0 + + + + + See Also + , + + diff --git a/doc/reference_type.xml b/doc/reference_type.xml index 6b31ab641..207063ee0 100644 --- a/doc/reference_type.xml +++ b/doc/reference_type.xml @@ -17,7 +17,7 @@ At least as of PostgreSQL 8.3 - Everything can be CAST to text (presumably because of the magical unknown type), so no defined CASTS for that need to be present for you to CAST an object to text. - PostgreSQL PostGIS Types + PostgreSQL PostGIS Geometry/Geography/Box Types @@ -188,26 +188,6 @@ - - - - geomval - A spatial datatype with two fields - geom (holding a geometry object) - and val (holding a double precision pixel value from a raster band) - - - - Description - geomval is a compound data type consisting of a geometry object referenced by the .geom field - and val, a double precision value that represents the pixel value at a particular geometric location in a raster band. - It is used by the ST_DumpAsPolygon and Raster intersection family of functions as an output type to explode a raster band into - geometry polygons. - - - See Also - - - @@ -244,45 +224,4 @@ , - - - - raster - raster spatial data type. - - - - Description - raster is a spatial data type used to represent raster data such as those imported from jpegs, tiffs, pngs, digital elevation models. - Each raster has 1 or more bands each having a set of pixel values. Rasters can be georeferenced. - - Requires PostGIS be compiled with GDAL support. Currently rasters can be implicitly converted to geometry type, but the conversion returns the - of the raster. This auto casting may be removed in the near future so don't rely on it. - - - - - Casting Behavior - This section lists the automatic as well as explicit casts allowed for this data type - - - - - Cast To - Behavior - - - geometry - automatic - - - - - - - - See Also - - - diff --git a/doc/xsl/raster_comments.sql.xsl b/doc/xsl/raster_comments.sql.xsl index fe155c19a..264833c88 100644 --- a/doc/xsl/raster_comments.sql.xsl +++ b/doc/xsl/raster_comments.sql.xsl @@ -13,7 +13,7 @@ - + @@ -41,27 +41,25 @@ COMMENT ON A - - - ' - - - - - - - - - - - - - - -COMMENT ON TYPE IS 'postgis type: '; - - - + + + ' + + + + + + + + + + + + + + COMMENT ON TYPE IS 'postgis raster type: '; + +