My question is within the context of working with pyproj, the popular python package wrapping OSGeo's PROJ library, but it probably spills over into coordinate transformations as a whole and transformation grids.
Pyproj
allows for constructing TransfomerGroup
s, which allow enumerating *each of the possible transformations between two coordinate reference systems.
When a TransformerGroup
is created, PROJ
is able to identify whether an available transformer is the best_available
TransformerGroup
. I would suspect that in each case, the only way that there would be a better transformation available, is whether the library could make use of a particular Transformation grid in that area.
Take the code below, I've set up two TransformerGroup
s, not downloaded any transformation grids. From the transformations below, in one case, we have better transformers available, and in another case, we do not.
# python
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyproj
>>> from pyproj.transformer import TransformerGroup
>>> tg = TransformerGroup(4326, 26917)
>>> tg
<TransformerGroup: best_available=True>
- transformers: 1
- unavailable_operations: 14
>>> tg2 = TransformerGroup(4326, 32155)
C:\Users\Michael.DiFelice\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyproj\transformer.py:207: UserWar
ning: Best transformation is not available due to missing Grid(short_name=us_noaa_wyhpgn.tif, full_name=, package_name
=, url=https://cdn.proj.org/us_noaa_wyhpgn.tif, direct_download=True, open_license=True, available=False)
super().__init__(
>>> tg2
<TransformerGroup: best_available=False>
- transformers: 1
- unavailable_operations: 5
>>> [t.name for t in tg2.unavailable_operations]
['Inverse of NAD83 to WGS 84 (44) + SPCS83 Wyoming East zone (meters)', 'Inverse of NAD83 to WGS 84 (19) + SPCS83 Wyom
ing East zone (meters)', 'Inverse of NAD83 to WGS 84 (36) + SPCS83 Wyoming East zone (meters)', 'Inverse of NAD83 to W
GS 84 (16) + SPCS83 Wyoming East zone (meters)', 'Inverse of NAD83 to WGS 84 (28) + SPCS83 Wyoming East zone (meters)'
]
How do we order transformations?
What makes one transformation better than another?
Having a best_available
transformation seems to imply ordinality with transformations, but without it always being tied to some transformation grid, I can't seem to guess what would make one better than another.
I've done some digging into pyproj
, and it seems as though the transformations are provided in an ordered list: https://github.com/pyproj4/pyproj/blob/7aab7d91e14230d846f74c418810652859d3c69d/pyproj/_transformer.pyx#L227-L258. best_available
is just indicating whether the first transformation is available or not. It doesn't answer the question, however, as to how transformations are ordered.