100 | | ---- |
101 | | == '''Objective B02x - Being able to intersect vector and raster to produce raster.''' == |
102 | | |
103 | | |
104 | | '''ST_Intersects(raster, raster)'''[[BR]] |
105 | | '''ST_AsRaster(geometry, pixelsize) -> raster'''[[BR]] |
106 | | '''ST_Intersection(geometry, val, raster, band) -> raster''' |
107 | | |
108 | | The first series of variant return a raster having the same extent as the provided raster. |
109 | | |
110 | | Variant 1: ST_Intersection(geometry, val, raster, band, pixeltype, nodatavalue) -> raster |
111 | | |
112 | | Variant 2: ST_Intersection(raster, band, geometry, val, pixeltype, nodatavalue) -> raster |
113 | | |
114 | | Variant 3: ST_Intersection(geometry, val, raster, pixeltype, nodatavalue) -> raster |
115 | | |
116 | | Variant 4: ST_Intersection(raster, geometry, val, pixeltype, nodatavalue) -> raster |
117 | | |
118 | | The second series of variant return a raster having the minimal extent. |
119 | | |
120 | | Variant 5: ST_Intersection(geometry, val, raster, band, pixeltype, nodatavalue, 'TRIM') -> raster |
121 | | |
122 | | Variant 6: ST_Intersection(raster, band, geometry, val, pixeltype, nodatavalue, 'TRIM') -> raster |
123 | | |
124 | | Variant 7: ST_Intersection(geometry, val, raster, pixeltype, nodatavalue, 'TRIM') -> raster |
125 | | |
126 | | Variant 8: ST_Intersection(raster, geometry, val, pixeltype, nodatavalue, 'TRIM') -> raster |
127 | | |
128 | | Return 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. |
129 | | |
130 | | The second band gets its pixeltype and nodatavalue from the parameters. |
131 | | |
132 | | Non intersecting pixels are filled with nodata values. |
133 | | |
134 | | Variant 1 return a raster having the same extent as the provided raster. |
135 | | |
136 | | Variant 3, 4, 7 and 8 defaults the band number to 1. |
137 | | |
138 | | 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). |
139 | | |
140 | | |
141 | | '''Open question''' |
142 | | |
143 | | 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. |
144 | | |
145 | | '''Implementation details''' |
146 | | |
147 | | 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. |
148 | | Should be implemented as a wrapper around ST_MapAlgebra after rasterizing the geometry to a raster having the same alignment as the raster. |
149 | | |
150 | | ---- |
151 | | == '''Objective B02x - Being able to use "group by" to accumulate tiles to form a new raster.''' == |
152 | | |
153 | | |
154 | | '''ST_Union(raster|geometry, raster|geometry, ‘raster’|’geometry’) -> raster/geometry'''[[BR]] |
155 | | '''ST_Accum(raster set|geometry set, ‘raster’|’geometry’) -> raster/geometry''' |