Changes between Version 83 and Version 84 of WKTRaster/SpecificationWorking01
- Timestamp:
- Dec 18, 2009, 2:04:00 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WKTRaster/SpecificationWorking01
v83 v84 237 237 This function could be roughly implemented as a SQL function looking like 'SELECT ST_Collect((ST_AsPolygon(raster)).geom)'. For sure a more specialised version could be faster than ST_AsPolygon. 238 238 239 '''ST_AsPolygon(raster) -> geomval set''' - Returns a set of "geomval" value, one for each group of pixel having the same value. 240 241 This is a set-returning function (SRF). A "geomval" value is a complex type composed of a polygon geometry (one for each group of contiguous pixel of sharing same value) and the value associated with these pixels. The value associated with the group of pixel are always returned as a double precision value. The shape of each polygon follow pixels edges. 242 239 '''ST_AsPolygon(raster) -> geomval set''' - Returns a set of "geomval" value, one for each contiguous group of pixel sharing the same value. 240 241 This is a set-returning function (SRF). A "geomval" value is a complex type composed of a polygon geometry (one for each contiguous group of pixel sharing the same value) and the value associated with this geometry. These values are always returned as a value of type double precision. The shape of each polygon follow pixels edges. 242 243 This function should be used with precaution on raster with float pixel type as it could return one "geomval" (or polygon) per pixel. This kind of raster should be reclassified (using the planned ST_Reclassify(raster,...) function) before using ST_AsPolygon(). 244 245 '''Implementation details''' 246 243 247 A ST_AsPolygon(raster, 'REGROUP') variant should regroup every resulting polygon having the same value into complex (or multipart) polygons. 244 245 This function should be used with precaution on raster with float pixel type as it could return one "geomval" (or polygon) per pixel. This kind of raster should be reclassified (using the planned ST_Reclassify(raster,...) function) before using ST_AsPolygon().246 247 '''Implementation details'''248 248 249 249 This function is at the base of the first version of ST_Intersection which compute the intersection between a raster and a geometry. … … 267 267 268 268 269 '''ST_AsWKTPolygon(raster) -> text set''' - Returns a set of text representation of geometry, one for each group of pixel having the same value. 269 '''ST_AsWKTPolygon(raster) -> wktgeomval set''' - Returns a set of "geomval" value, one for each contiguous group of pixel sharing the same value. 270 271 This is a set-returning function (SRF). A "wktgeomval " value is a complex type composed of a the wkt representation of a geometry (one for each contiguous group of pixel sharing the same value) and the value associated with this geometry. These values are always returned as a value of type double precision. The shape of each polygon follow pixels edges. 272 273 This function should be used with precaution on raster with float pixel type as it could return one "geomval" (or polygon) per pixel. This kind of raster should be reclassified (using the planned ST_Reclassify(raster,...) function) before using ST_AsPolygon(). 270 274 271 275 '''Implementation details''' … … 273 277 This function construct the WKT strings representing the geometries grouping pixels of a raster having the same value. It does not directly construct geometries and therefore prevent WKT Raster from having to link with liblwgeom.a (see "Why avoid to link with PostGIS?" below) It should also return the value associated with this WKT polygon. 274 278 275 Ways for a pg/plSQL or SQL function to return many columns: 276 277 Functions with Output Parameters (PgSQL doc 34.4.3): 278 279 CREATE FUNCTION sum_n_product(x int, y int, OUT sum int, OUT product int)[[BR]] 280 AS 'SELECT $1 + $2, $1 * $2'[[BR]] 281 LANGUAGE SQL; 282 283 The function must be called in the FROM clause, otherwise it returns a 284 285 SELECT * FROM sum_n_product(11,42); 286 287 288 Ways for a pg/plSQL or SQL function to return many rows: 289 290 It should be implemented by passing the raster to GDAL and convert each polygon produced by the [http://www.gdal.org/gdal__alg_8h.html GDALPolygonize function] to a WKT string. 279 It should be implemented as a C function passing the raster to GDAL and converting each polygon produced by the [http://www.gdal.org/gdal__alg_8h.html GDALPolygonize function] to a WKT string accompagned by its corresponding value in a wktgeomval type. See http://www.postgresql.org/docs/8.4/interactive/xfunc-c.html#AEN44970 on how to return rows and sets. 291 280 292 281