Ticket #1331 (closed enhancement: duplicate)
[raster] Physically relevant geotransform settings
|Reported by:||bnordgren||Owned by:||pracine|
I only have the forward calculations worked out and described on the wiki. I have an approach in mind for the reverse calculations.
Algorithm documentation: DevWikiAffineParameters
This could stand to be reviewed/edited (for clarity and correctness) by someone other than me. Code will follow feedback on the proposed algorithm.
This approach allows users to specify the geotransform in terms of the following parameters:
- The magnitude of the ib basis vector (distance between pixels along i axis)
- The magnitude of the jb basis vector (distance between pixels along j axis)
- The angle θi (the angle by which the raster's grid needs to be rotated, positive clockwise -- for compatibility with "heading/bearing")
- The angle θij (the angle from the i basis vector to the j basis vector positive counterclockwise -- for consistency with right-handed coordinate system)
- The offsets tx and ty
This would likely result in a single function with a signature like:
ST_SetGeoTransform(raster raster, float8 i_magnitude, float8 j_magnitude, float8 theta_i default 0, float8 theta_ij default -90)
... or the equivalent if I pooched the SQL syntax.
We should also downplay the scale/skew accessors after this is implemented. They're still relevant for copying individual parameters from an external source, but it's almost never appropriate to change just one or two of them. ...and the names for the parameters are somewhat misleading.