Changes between Version 152 and Version 153 of WKTRaster/SpecificationWorking03


Ignore:
Timestamp:
09/11/11 12:46:43 (13 years ago)
Author:
dustymugs
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • WKTRaster/SpecificationWorking03

    v152 v153  
    2525
    2626'''ST_Intersects(raster, raster)'''[[BR]]
     27
     28This function uses the same tests as the two geometry version of ST_Intersects where tests see if two rasters overlap, touches or has one within the other.  If any condition is true, the two rasters intersect.
     29
     30For this description, the rasters are called A and B and the bands tested are assumed to be 1.
     31
     32Preliminary criteria before the real work begins:
     33
     341. make sure that rasters A and B have the same SRID.  if not, return false.
     35
     362. make sure that the convex hulls of A and B intersect.  if not, return false.
     37
     38Special case where a raster may be fully contained within another raster's cell (the entirety of A within a cell of B):
     39
     401. using a 3x3 search pattern, test each selected cell's geopoint (excluding no data by default unless exclude_nodata_value = FALSE) of A to that of B for overlap.
     41
     422. if a cell of A does overlap a cell of B, return true.
     43
     443. if no cell of A overlaps with B, continue to additional testing
     45
     46Actual testing involves the use of calculating the intersection of grid lines between A and B
     47
     481. Using A's columns and B's rows in a 3x3 search pattern, calculate the intersection point of each pair of grid lines.
     49
     502. If intersection point doesn't exist or is outside the bounds of the end points comprising each grid line used, go back to step 1.
     51
     523. If intersection point exists and within bounds, sample the area around the intersection point by offset the intersection point by a small amount (1/10th of the smaller scale of A and B) for 360 degrees starting from 00:00.  sampled points are 0, 45, 90, 135, 180, 225, 270 and 315 degrees.
     53
     544. At each sample point, test to see if the geopoint has non-nodata (unless including nodata) values in both A and B.  if so, return true.
     55
     565. At the same time as step 4, build an adjacency matrix for the intersection to see if two non-overlapping pixels from A and B touch.
     57
     586. Once all sample points have been tested and no overlapping pixels found, the adjacency matrix is checked to see if any sampled pixel of A touched a sampled pixel of B.  If two pixels touched, return true.
     59
     607. If after all the searching and testing, nothing intersects or touches, return false.
     61
     62A set of ST_Intersects functions:
     63
     641. ST_Intersects(raster rastA, raster rastB, integer bandA DEFAULT NULL, integer bandB DEFAULT NULL) -> boolean
     65
     66If bandA and bandB are NULL, only the convex hulls of the rasters will be tested.  If bandA or bandB are provided, both parameters must be provided and not NULL.
     67
     682. ST_Intersects(raster rastA, integer bandA, raster rastB, integer bandB) -> boolean
     69
     70The ST_Intersects(raster, geometry) functions may need to be adapted to use ST_Intersects(raster, raster).  The difficulty will be for the functions to decide whether or not converting the raster to a geometry or converting the geometry to a raster is faster.
     71
    2772'''ST_AsRaster(geometry, pixeltype, val, nodataval, ulx, uly, width, height, pixelsizex, pixelsizey, skewx, skewy) -> raster - done see below'''
    2873