In geospatial data, the index (0, 0) tends to be at the top-left corner of the image, but unless we put additional restrictions on the format of spatial:transform, this is not necessarily true.
I think we should probably update the text to say (0, 0) is normally the top-left corner but isn't required by the spec.
|
- `a`: pixel width (w-e pixel resolution) |
|
- `b`: row rotation (typically 0) |
|
- `c`: x-coordinate of the upper-left corner of the upper-left pixel |
|
- `d`: column rotation (typically 0) |
|
- `e`: pixel height (n-s pixel resolution, negative value for north-up images) |
|
- `f`: y-coordinate of the upper-left corner of the upper-left pixel |
|
|
|
**Coordinate convention:** |
|
|
|
The transform operates on array indices where `(0, 0)` is at the **top-left corner** of the top-left pixel, and `(width, height)` is at the bottom-right corner of the bottom-right pixel. The center of the top-left pixel is at `(0.5, 0.5)`. |
|
|
|
This follows the GDAL geotransform and Python's Affine library convention. |
|
|
|
Note: Rasterio's `xy()` and `rowcol()` methods automatically add/subtract 0.5 to convert between pixel coordinates and corner coordinates. For example, `transformer.xy(0, 0)` is equivalent to applying this transform to `(0.5, 0.5)`, giving the coordinate at the center of the first pixel. |
In geospatial data, the index (0, 0) tends to be at the top-left corner of the image, but unless we put additional restrictions on the format of
spatial:transform, this is not necessarily true.I think we should probably update the text to say
(0, 0)is normally the top-left corner but isn't required by the spec.spatial/README.md
Lines 148 to 161 in 59dd7f4