15 | | == '''Objective B03a - Being able to intersect two raster to get a raster.''' == |
16 | | |
17 | | '''ST_Intersection(raster, integer, raster, integer) -> raster''' - Returns a two bands raster with values only in the intersecting areas of both rasters. Integer parameters are the band number of the raster. |
18 | | |
19 | | '''Variants''' |
20 | | |
21 | | 1) ST_Intersection(raster, integer, raster, integer) -> raster -- the integer parameters are the band number of the rasters[[BR]] |
22 | | 2) ST_Intersection(raster, raster, integer) -> raster -- default first raster to band # 1[[BR]] |
23 | | 3) ST_Intersection(raster, integer, raster) -> raster -- default second raster to band # 1[[BR]] |
24 | | 4) ST_Intersection(raster, raster) -> raster -- default both rasters to band # 1 |
25 | | |
26 | | ---- |
27 | | == '''Objective B03b - Being able to intersect two raster to get a geometry.''' == |
28 | | |
29 | | '''ST_Intersection(raster, integer, raster, integer, 'geometry') -> geometry''' - Returns a two bands raster with values only in the intersecting areas of both rasters. Integer parameters are the band number of the raster. |
30 | | |
31 | | |
32 | | '''Variants''' |
33 | | |
34 | | 1) ST_Intersection(raster, integer, raster, integer, 'geometry') -> geometry[[BR]] |
35 | | 2) ST_Intersection(raster, raster, integer, 'geometry') -> geometry -- default first raster to band # 1[[BR]] |
36 | | 3) ST_Intersection(raster, integer, raster, 'geometry') -> geometry -- default second raster to band # 1[[BR]] |
37 | | 4) ST_Intersection(raster, raster, 'geometry') -> geometry -- default both raster to band # 1 |
38 | | |
39 | | ---- |
40 | | == '''Objective B03c - Being able to reproject a raster.''' == |
| 15 | == '''Objective 02 - Being able to intersect vector and raster to produce raster.''' == |
| 16 | |
| 17 | |
| 18 | '''ST_Intersects(raster, raster)'''[[BR]] |
| 19 | '''ST_AsRaster(geometry, pixelsize) -> raster'''[[BR]] |
| 20 | '''ST_Intersection(geometry, val, raster, band) -> raster''' |
| 21 | |
| 22 | The first series of variant return a raster having the same extent as the provided raster. |
| 23 | |
| 24 | Variant 1: ST_Intersection(geometry, val, raster, band, pixeltype, nodatavalue) -> raster |
| 25 | |
| 26 | Variant 2: ST_Intersection(raster, band, geometry, val, pixeltype, nodatavalue) -> raster |
| 27 | |
| 28 | Variant 3: ST_Intersection(geometry, val, raster, pixeltype, nodatavalue) -> raster |
| 29 | |
| 30 | Variant 4: ST_Intersection(raster, geometry, val, pixeltype, nodatavalue) -> raster |
| 31 | |
| 32 | The second series of variant return a raster having the minimal extent. |
| 33 | |
| 34 | Variant 5: ST_Intersection(geometry, val, raster, band, pixeltype, nodatavalue, 'TRIM') -> raster |
| 35 | |
| 36 | Variant 6: ST_Intersection(raster, band, geometry, val, pixeltype, nodatavalue, 'TRIM') -> raster |
| 37 | |
| 38 | Variant 7: ST_Intersection(geometry, val, raster, pixeltype, nodatavalue, 'TRIM') -> raster |
| 39 | |
| 40 | Variant 8: ST_Intersection(raster, geometry, val, pixeltype, nodatavalue, 'TRIM') -> raster |
| 41 | |
| 42 | Returns a two bands raster the first band containing only the pixels from the provided raster intersecting with the geometry and the second band containing the same area filled with the provided value. |
| 43 | |
| 44 | The second band gets its pixeltype and nodatavalue from the parameters. |
| 45 | |
| 46 | Non intersecting pixels are filled with nodata values. |
| 47 | |
| 48 | Variant 1 return a raster having the same extent as the provided raster. |
| 49 | |
| 50 | Variant 3, 4, 7 and 8 defaults the band number to 1. |
| 51 | |
| 52 | Variant 5 to 8 "trim" or "crop" the raster to the withvalue extent (removing extra nodata value pixels surrounding the extent of the resulting withvalue extent). |
| 53 | |
| 54 | |
| 55 | '''Open question''' |
| 56 | |
| 57 | PR: Shoud we return one raster per raster/geometry couple or split the raster into as many small rasters as there are areas sharing a same value? The second behavior seems more coherent with the present behavior of ST_Intersection(raster, geometry) -> geometry even if this would produce tons of small two bands rasters. |
| 58 | |
| 59 | '''Implementation details''' |
| 60 | |
| 61 | Rasterize the geometry as a new raster (ST_AsRaster(geometry, pixeltype, val, nodataval, raster)) and then copy only pixels for which both raster bands have a value. |
| 62 | Should be implemented as a wrapper around ST_MapAlgebra after rasterizing the geometry to a raster having the same alignment as the raster. |
| 63 | |
| 64 | ---- |
| 65 | == '''Objective 03 - Being able to use "group by" to accumulate tiles to form a new raster.''' == |
| 66 | |
| 67 | |
| 68 | '''ST_Union(raster|geometry, raster|geometry, ‘raster’|’geometry’) -> raster/geometry'''[[BR]] |
| 69 | '''ST_Accum(raster set|geometry set, ‘raster’|’geometry’) -> raster/geometry''' |
| 70 | |
| 71 | |
| 72 | ---- |
| 73 | == '''Objective 05 - Being able to reproject a raster.''' == |
197 | | '''Other functions''' |
| 195 | ---- |
| 196 | == '''Objective 14 - Being able to intersect two rasters to get a raster.''' == |
| 197 | |
| 198 | '''ST_Intersection(raster, integer, raster, integer) -> raster''' - Returns a two bands raster with values only in the intersecting areas of both rasters. Integer parameters are the band number of the raster. |
| 199 | |
| 200 | '''Variants''' |
| 201 | |
| 202 | 1) ST_Intersection(raster, integer, raster, integer) -> raster -- the integer parameters are the band number of the rasters[[BR]] |
| 203 | 2) ST_Intersection(raster, raster, integer) -> raster -- default first raster to band # 1[[BR]] |
| 204 | 3) ST_Intersection(raster, integer, raster) -> raster -- default second raster to band # 1[[BR]] |
| 205 | 4) ST_Intersection(raster, raster) -> raster -- default both rasters to band # 1 |
| 206 | |
| 207 | ---- |
| 208 | == '''Objective 15 - Being able to intersect two rasters to get a geometry.''' == |
| 209 | |
| 210 | '''ST_Intersection(raster, integer, raster, integer, 'geometry') -> geometry''' - Returns a two bands raster with values only in the intersecting areas of both rasters. Integer parameters are the band number of the raster. |
| 211 | |
| 212 | |
| 213 | '''Variants''' |
| 214 | |
| 215 | 1) ST_Intersection(raster, integer, raster, integer, 'geometry') -> geometry[[BR]] |
| 216 | 2) ST_Intersection(raster, raster, integer, 'geometry') -> geometry -- default first raster to band # 1[[BR]] |
| 217 | 3) ST_Intersection(raster, integer, raster, 'geometry') -> geometry -- default second raster to band # 1[[BR]] |
| 218 | 4) ST_Intersection(raster, raster, 'geometry') -> geometry -- default both raster to band # 1 |
| 219 | |
| 220 | ---- |
| 221 | == '''Objective 16 - Being able to quickly get raster statistics.''' == |
| 222 | |
| 223 | '''Add cached basic raster statistic to the base raster WKB format. |
| 224 | |
| 225 | ---- |
| 226 | == '''Objective 17 - Being able to refer to band by textual name.''' == |
| 227 | |
| 228 | '''Add 8 digit string to each band in the base raster WKB format. |
| 229 | |
| 230 | '''Adjust gdal2wktraster.py to be able to give names to each band when importing. |
| 231 | |
| 232 | '''Adjust/overlaod every function to be able to refer to raster band by name. |
| 233 | |
| 234 | ---- |
| 235 | == '''Objective 18 - Being able to load rasters from SQL''' == |
| 236 | |
| 237 | The idea is to change the rt_band_get_data core function so it load filesystem registered raster data using GDAL into the data base. This allow us to create a list of raster with a new ST_MakeRegisteredRaster("c:/temp/mytiff/*.tif") and to convert them witinot a CREATE TABLE with a ST_MakeBandInDB(rast, band) |
| 238 | |
| 239 | '''Changes to the rt_band_get_data core function'''[[BR]] |
| 240 | '''ST_MakeRegisteredRaster(wildcardPath)'''[[BR]] |
| 241 | '''ST_SetPath(raster, band, string)'''[[BR]] |
| 242 | '''ST_MakeBandInDB(rast, band)''' |
| 243 | |
| 244 | ---- |
| 245 | == '''Other functions''' == |