Changes between Version 100 and Version 101 of WKTRaster/SpecificationWorking01
- Timestamp:
- 01/05/10 14:47:30 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified WKTRaster/SpecificationWorking01
v100 v101 251 251 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 252 252 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. 254 254 255 255 This polygon geometry might contain holes if some internal areas of the raster contain pixels with NODATA values. 256 256 257 Variant 1: ST_Shape(raster) -> polygon geometry -- default to band # 1 258 257 259 '''Implementation details''' 258 260 259 261 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. 260 262 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. 262 264 263 265 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. 264 266 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 265 271 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(). 266 272 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''' 270 276 271 277 This function is at the base of the first version of ST_Intersection which compute the intersection between a raster and a geometry. … … 290 296 [[Image(WKTRasterAsPolygon.gif)]] 291 297 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. 293 299 294 300 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. … … 305 311 306 312 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 310 318 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 312 322 313 323 This function permform a full intersection test and proceed in three steps to determine if the raster intersects with the geometry: … … 319 329 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. 320 330 321 Variant 2proceeds 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). 322 332 323 333 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): … … 335 345 It might be faster to skip test 2) if this test is not signicantly faster than test 3). 336 346 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. 338 348 339 349 Variant 1: 340 350 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 352 374 353 375 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.