Changes between Version 100 and Version 101 of WKTRaster/SpecificationWorking01


Ignore:
Timestamp:
Jan 5, 2010, 2:47:30 PM (14 years ago)
Author:
pracine
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • WKTRaster/SpecificationWorking01

    v100 v101  
    251251 This function is actually already implemented by the ST_raster_envelope() function which is wrongly named. There is also a ticket (#348) related to this function: http://trac.osgeo.org/postgis/ticket/348
    252252
    253 '''ST_Shape(raster) -> polygon geometry''' - Returns a geometry encomparsing every pixel having a significant value (different than the NODATA value).
     253'''ST_Shape(raster, integer) -> polygon geometry''' - Returns a geometry encomparsing every pixel having a significant value (different than the NODATA value) for the provided band.
    254254
    255255 This polygon geometry might contain holes if some internal areas of the raster contain pixels with NODATA values.
    256256
     257 Variant 1: ST_Shape(raster) -> polygon geometry -- default to band # 1
     258
    257259 '''Implementation details'''
    258260
    259261 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.
    260262
    261 '''ST_AsPolygon(raster) -> geomval set''' - Returns a set of "geomval" value, one for each group of pixel sharing the same value.
     263'''ST_AsPolygon(raster, integer) -> geomval set''' - Returns a set of "geomval" value, one for each group of pixel sharing the same value for the provided band.
    262264
    263265 This is a set-returning function (SRF). A "geomval" value is a complex type composed of a polygon geometry (one for each 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.
    264266
     267 Variant 1: ST_AsPolygon(raster) -> geomval set -- default to band # 1
     268 Variant 2: ST_AsPolygon(raster, integer, 'UNGROUP')
     269 Variant 3: ST_AsPolygon(raster, 'UNGROUP') -- default to band # 1
     270
    265271 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().
    266272
    267  '''Implementation details'''
    268  
    269  A ST_AsPolygon(raster, 'REGROUP') variant should regroup every resulting polygon having the same value into complex (or multipart) polygons.
     273 Variant 2 splits every resulting complex polygon sharing the same value into simple (or singlepart) polygons.
     274
     275 '''Implementation details'''
    270276 
    271277 This function is at the base of the first version of ST_Intersection which compute the intersection between a raster and a geometry.
     
    290296[[Image(WKTRasterAsPolygon.gif)]]
    291297
    292 '''ST_AsWKTPolygon(raster) -> wktgeomval set''' - Returns a set of "geomval" value, one for each group of pixel sharing the same value.
     298'''ST_AsWKTPolygon(raster, band) -> wktgeomval set''' - Returns a set of "geomval" value, one for each group of pixel sharing the same value for the provided band.
    293299
    294300 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 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.
     
    305311
    306312
    307 '''ST_Intersects(raster, geometry) -> boolean''' - Returns TRUE if the geometry and the raster "spatially intersect" - (share any portion of space) and FALSE if they don't (they are Disjoint).
    308 
    309  Variant 1: ST_Intersects(geometry, raster) -> boolean
     313'''ST_Intersects(raster, integer, geometry) -> boolean''' - Returns TRUE if the geometry and the raster "spatially intersect" - (share any portion of space) and FALSE if they don't (they are Disjoint).
     314
     315 Variant 1: ST_Intersects(geometry, raster, integer) -> boolean
     316
     317 Variant 2: ST_Intersects(geometry, raster) -> boolean -- default to band # 1
    310318 
    311  Variant 2: ST_Intersects(raster, raster) -> boolean
     319 Variant 3: ST_Intersects(raster, geometry) -> boolean -- default to band # 1
     320
     321 Variant 4: ST_Intersects(raster, raster) -> boolean
    312322
    313323 This function permform a full intersection test and proceed in three steps to determine if the raster intersects with the geometry:
     
    319329 3) If the second test returns TRUE, it checks if the geometry returned by ST_Shape(raster) intersects with the geometry. This test is slower since it involve the computation of the raster shape and it might involve the geometry shape.
    320330
    321  Variant 2 proceeds in a very similar way except that convex hulls of both rasters are computed and compared in step 2) and both shape of raster are computed and compared in step 3).
     331 Variant 4 proceeds in a very similar way except that convex hulls of both rasters are computed and compared in step 2) and both shape of raster are computed and compared in step 3).
    322332
    323333 If you want to limit the intersection test to the first condition, simply use the && operator. The raster and the geometry will be casted to their respective bounding box (box2d objects):
     
    335345 It might be faster to skip test 2) if this test is not signicantly faster than test 3).
    336346
    337 '''ST_Intersection(raster, geometry) -> geometry''' - Returns a geometry that represents the shared portion of the geometry and the raster.
     347'''ST_Intersection(raster, integer, geometry) -> geometry''' - Returns a geometry that represents the shared portion of the geometry and the raster areas sharing a common meaningfull values.
    338348
    339349 Variant 1:
    340350
    341   ST_Intersection(geometry, raster) -> geometry
    342 
    343  Variant 2 & 3:
    344 
    345   ST_Intersection(raster, geometry, 'raster') -> raster[[BR]]
    346   ST_Intersection(geometry, raster, 'raster') -> raster
    347 
    348  Variant 4 & 5:
    349 
    350   ST_Intersection(raster, raster) -> raster[[BR]]
    351   ST_Intersection(raster, raster, 'geometry') -> geometry
     351  ST_Intersection(raster, geometry) -> geometry -- default to band # 1[[BR]]
     352  ST_Intersection(geometry, raster, integer) -> geometry[[BR]]
     353  ST_Intersection(geometry, raster) -> geometry -- default to band # 1
     354
     355 Variant 2:
     356
     357  ST_Intersection(raster, integer, geometry, 'raster') -> raster[[BR]]
     358  ST_Intersection(raster, geometry, 'raster') -> raster -- default to band # 1
     359
     360 Variant 3:
     361
     362  ST_Intersection(geometry, raster, integer, 'raster') -> raster[[BR]]
     363  ST_Intersection(geometry, raster, 'raster') -> raster -- default to band # 1
     364
     365 Variant 4:
     366
     367  ST_Intersection(raster, integer, raster, integer) -> raster[[BR]]
     368  ST_Intersection(raster, raster) -> raster -- default to band # 1
     369
     370 Variant 5:
     371
     372  ST_Intersection(raster, integer, raster, integer, 'geometry') -> geometry
     373  ST_Intersection(raster, raster, 'geometry') -> geometry -- default to band # 1
    352374
    353375 Returns a geometry that represents the point set intersection of the geometry and the raster. The raster is first polygonised using ST_AsPolygon(raster) and ST_Intersection(geometry, geometry) is then performed between the provided geometry and all the geometries resulting from the polygonisation of the raster.