196 | | '''ST_SameAlignment(raster, raster) -> boolean''' |
197 | | |
198 | | This function returns true if both rasters' grids are aligned. |
199 | | |
200 | | Two rasters grid are aligned if: |
201 | | |
202 | | -They share the same pixel scales and skews |
203 | | |
204 | | -At least one of any of the four corner of any pixel of one raster fall on any corner of the grid of the other raster. |
205 | | |
206 | | Alignment is not the same concept as georeference. Two rasters can be aligned but not have the same georeference. |
207 | | |
208 | | Rotation is important here since two rasters grid might look perfectly aligned but are not if their rotated are different. |
209 | | |
210 | | Knowing if two rasters share the same alignment is useful when it is time to decide if one of them must be resampled before doing other operations (like ST_MapAlgebra on two rasters). |
211 | | |
212 | | '''Variants''' |
213 | | |
214 | | 1) ST_SameAlignment(ulx1, uly1, scalex1, scaley1, skewx1, skewy1, ulx2, uly2, scalex2, scaley2, skewx2, skewy2) |
215 | | |
216 | | 2) ST_SameAlignment(rast1 raster, rast2 raster) |
217 | | |
218 | | The first variant is useful to PL/pgSQL function which have already get the values of the parameters. |
219 | | |
220 | | '''Implementation Details''' |
221 | | |
222 | | Only the first variant should be implemented in C. The second one is a PL/pgSQL variants. The C implementation should follow the PL/pgSQL version implemented in http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_mapalgebra.sql |
223 | | |
224 | | It is not clear if this PL/pgSQL implementation works when raster are rotated. To verify. |
225 | | |
226 | | See discussion in http://trac.osgeo.org/postgis/ticket/589 |
227 | | |
228 | | Bborie: |
229 | | |
230 | | The variant that should be developed in C is (2) as it is more likely that someone will have two rasters instead of that large set of raster elements. Instead, (1) should be a pl/pgsql function calling (2). |
| 196 | '''ST_SameAlignment(raster, raster) -> boolean - done see below''' |
| 2878 | == '''Objective FV.03 - Implement all the necessary versions of ST_MapAlgebra''' == |
| 2879 | |
| 2880 | '''ST_SameAlignment(raster, raster) -> boolean''' |
| 2881 | |
| 2882 | This function returns true if both rasters' grids are aligned. |
| 2883 | |
| 2884 | Two rasters grid are aligned if: |
| 2885 | |
| 2886 | * They share the same pixel scales and skews |
| 2887 | |
| 2888 | * At least one of any of the four corner of any pixel of one raster fall on any corner of the grid of the other raster. |
| 2889 | |
| 2890 | Alignment is not the same concept as georeference. Two rasters can be aligned but not have the same georeference. |
| 2891 | |
| 2892 | Rotation is important here since two rasters grid might look perfectly aligned but are not if their rotated are different. |
| 2893 | |
| 2894 | Knowing if two rasters share the same alignment is useful when it is time to decide if one of them must be resampled before doing other operations (like ST_MapAlgebra on two rasters). |
| 2895 | |
| 2896 | The variants of ST_SameAlignment are: |
| 2897 | |
| 2898 | 1. ST_SameAlignment(rast1 raster, rast2 raster) |
| 2899 | |
| 2900 | 2. ST_SameAlignment(ulx1, uly1, scalex1, scaley1, skewx1, skewy1, ulx2, uly2, scalex2, scaley2, skewx2, skewy2) |
| 2901 | |
| 2902 | ~~The first variant is useful to PL/pgSQL function which have already get the values of the parameters. |
| 2903 | |
| 2904 | ~~'''Implementation Details''' |
| 2905 | |
| 2906 | ~~Only the first variant should be implemented in C. The second one is a PL/pgSQL variants. The C implementation should follow the PL/pgSQL version implemented in http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_mapalgebra.sql |
| 2907 | |
| 2908 | ~~It is not clear if this PL/pgSQL implementation works when raster are rotated. To verify. |
| 2909 | |
| 2910 | ~~See discussion in http://trac.osgeo.org/postgis/ticket/589 |
| 2911 | |
| 2912 | ~~Bborie: |
| 2913 | |
| 2914 | ~~The variant that should be developed in C is (2) as it is more likely that someone will have two rasters instead of that large set of raster ~~elements. Instead, (1) should be a pl/pgsql function calling (2). |
| 2915 | |
| 2916 | ---- |