31 | | TBD |
| 31 | When assigning an index CRS as native reference system of a coverage, there are a few things that needs to be kept in mind: where to put the origin and which offset vectors (relative vectorial offsets) are needed. |
| 32 | If you are not familiar with origin and offset vectors, please check [wiki:PetascopeUserGuide#Offsetvectorsandcoefficients this] section. |
| 33 | |
| 34 | `rasdaman` users are typically familiar with the '''`CRS:1`''' keyword, which is a shortcut to tell the service that you are going to use internal marray (grid) coordinates in the subset: |
| 35 | |
| 36 | {{{ |
| 37 | for cov in ( <coverage_name> ) |
| 38 | return encode( |
| 39 | cov[ Long:"CRS:1"(0:100), Lat:"CRS:1"(0:200) ] |
| 40 | , "csv") |
| 41 | }}} |
| 42 | |
| 43 | The ''internal'' `CRS:1` space needs not be confused with Index CRSs (although there are ways to make them coincide): an important premise is that `rasdaman`, along with many other [http://www.remotesensing.org/geotiff/faq.html?What%20is%20the%20purpose%20of%20GeoTIFF%20format%20for%20satellite%20data#AxisOrder common GIS policies], puts origin in the '''upper-left''' corner of an image. This means in practice that picking the first row of an image (slice `0` on the northings axis) will return the top row, and increasing ''internal'' coordinates will yield negative steps in the geo-CRS. |
| 44 | |
| 45 | The internal representation of a grid is represented by an origin (usually in `[0:__:0:__:0]`) and unit integral spacing. When using index CRSs, in order to correctly visualize an image, you must take care to properly set the offset vectors. |
| 48 | |
| 49 | Lookig at the picture above, you can see correct and faulty ways of defining the ''external'' index representation of a grid (2D case): |
| 50 | |
| 51 | * '''`I quadrant (+/+)`''': origin is upperleft corner, `i`-vector is the positive `i`-versor `[1,0]` while the `j`-vector points down (`[0,-1]`) so that inverse proportionality on the second grid axis between internal and external representation is correctly maintained. |
| 52 | * '''`II quadrant (-/+)`''': `j`-vector is set as `[0,1]` and as a consequence the origin becomes the lower-left corner of the image: as a result we will see the image upside-down. |
| 53 | * '''`III quadrant (-/-)`''': origin is correctly set in the upper-left corner, but offset vectors have norm greater than one: while this is a technically viable solution, it also means that we lose the pixel-index correspondence: one internal index step equals a jump of 2 indexes in the external representation. |
| 54 | * '''`IV quadrant (+/-)`''': similarly, it does not make much sense to define vectors with norm less than one: moreover this solution would even prevent from slicing those point which do not lie over a legal area of the index CRS (at fractional positions). |
| 55 | |
| 56 | This example is aimed at underlining the difference between the `CRS:1` internal grid representation and the set of index CRSs. Albeit they are different concepts, they can also coincide in case ''i)'' the `i`/`j` coordinates of the origin equal the internal indexes of the grid (which is usually but not necessarily in `[0:0:__:0]`), ''ii)'' the offset vectors are the versors of the nD cartesian CS. |
| 57 | |
| 58 | For some hands-on `RasQL`/WC*S query, our [browser:systemtest/util/petascope.sh test datasets] are actively using index CRSs: `mr` and `rgb` are 2D images, whereas `irr_cube_1` is a fictitious toy 3D cube (with irregular spacing on the third `k` dimension) which purposely synchronizes its internal and external representation. See [RasdamanTestSuites this] page for more information. |
| 59 | |