Skip to content

Commit 0fba4ea

Browse files
Merge pull request #10 from Kirill888/main
Add clarification about `proj:transform` (#9)
2 parents 7f1a206 + be05941 commit 0fba4ea

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,29 @@ the default shape for all assets that don't have an overriding shape. This can b
103103
Linear mapping from pixel coordinate space (Pixel, Line) to projection coordinate space (Xp, Yp). It is
104104
a `3x3` matrix stored as a flat array of 9 elements in row major order. Since the last row is always `0,0,1` it can be omitted,
105105
in which case only 6 elements are recorded. This mapping can be obtained from
106-
GDAL([`GetGeoTransform`](https://gdal.org/api/gdaldataset_cpp.html#_CPPv4N11GDALDataset15GetGeoTransformEPd)) or the Rasterio
107-
([`Transform`](https://rasterio.readthedocs.io/en/stable/api/rasterio.io.html#rasterio.io.BufferedDatasetWriter.transform)).
106+
GDAL([`GetGeoTransform`](https://gdal.org/api/gdaldataset_cpp.html#_CPPv4N11GDALDataset15GetGeoTransformEPd), requires re-ordering)
107+
or the Rasterio ([`Transform`](https://rasterio.readthedocs.io/en/stable/api/rasterio.io.html#rasterio.io.BufferedDatasetWriter.transform)).
108108
To get it on the command line you can use the [Rasterio CLI](https://rasterio.readthedocs.io/en/latest/cli.html) with the
109109
[info](https://rasterio.readthedocs.io/en/latest/cli.html#info) command: `$ rio info`.
110110

111-
``` bash
111+
```
112112
[Xp] [a0, a1, a2] [Pixel]
113113
[Yp] = [a3, a4, a5] * [Line ]
114114
[1 ] [0 , 0, 1] [1 ]
115115
```
116116

117117
If the transform is defined in Item Properties, it is used as the default transform for all assets that don't have an overriding transform.
118118

119+
Note that `GetGeoTransform` and `rasterio` use different formats for reporting transform information. Order expected in `proj:transform` is the
120+
same as reported by `rasterio`. When using GDAL method you need to re-order in the following way:
121+
122+
```
123+
g = GetGeoTransform(...)
124+
proj_transform = [g[1], g[2], g[0],
125+
g[4], g[5], g[3],
126+
0, 0, 1]
127+
```
128+
119129
## Centroid Object
120130

121131
This object represents the centroid of the Item Geometry.

0 commit comments

Comments
 (0)