-
Hello community ! Problem description I have 2
transformer = pyproj.Transformer.from_crs(crs32631.geodetic_crs, crs32631)
bounds_32631 = transformer.transform([0, 6], [0, 84]) #([array_of_x], [array_of_y])
print(bounds_32631)
>>> ([166021.44308054057, 534994.6550611363], [0.0, 9329005.182447437]) # ([xmin, xmax], [ymin, ymax])
bounds_32631_tb = transformer.transform_bounds(0, 0, 6, 84) #(left, bottom, right, top)
print(bounds_32631_tb)
>>> (166021.44308054057, 0.0, 833978.5569194613, 9329005.182447437) #(xmin, ymin, xmax, ymax) Furthermore, when I compute the inverse transforms, more inconsistencies appear:
bounds_32631_inv = transformer.transform(*bounds_32631, direction="INVERSE", errcheck=True) #([array_of_x], [array_of_y])
print(bounds_32631_inv)
>>> ([3.975693351829396e-16, 6.0], [0.0, 84.0]) # ([xmin, xmax], [ymin, ymax]) OK (up to numerical approximations)
bounds_32631_tb_inv = transformer.transform_bounds(*bounds_32631_tb, direction="INVERSE", errcheck=True) #(left, bottom, right, top)
print(bounds_32631_tb_inv)
>>> (-23.58287765881726, 0.0, 29.58287765881738, 84.00816352991251) #(xmin, ymin, xmax, ymax) KO (
bounds_32631_inv_tb = transformer.transform_bounds(bounds_32631[0][0], bounds_32631[1][0], bounds_32631[0][1], bounds_32631[1][1], direction="INVERSE", errcheck=True) #(left, bottom, right, top)
print(bounds_32631_inv_tb)
>>> (-23.58287765881726, 0.0, 6.0, 84.00814947301849) #(xmin, ymin, xmax, ymax) KO (
bounds_32631_tb_inv = transformer.transform([bounds_32631_tb[0], bounds_32631_tb[2]], [bounds_32631_tb[1], bounds_32631_tb[3]], direction="INVERSE", errcheck=True) #([array_of_x], [array_of_y])
print(bounds_32631_tb_inv)
>>> ([3.975693351829396e-16, 29.58287765881738], [0.0, 83.30591198713375]) # ([xmin, xmax], [ymin, ymax]) KO ( Questions Installation |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Related: #809 This is likely a helpful reference to visually demonstrate what is going on: ref |
Beta Was this translation helpful? Give feedback.
-
Thank you for the provided resources. I understand well that non-linear transformations are implied in some CRS projections. However I'm also interested in the underlying reasons of these transformations. |
Beta Was this translation helpful? Give feedback.
That is not necessarily what is happening. The shape of the boundary in one projection can be quite different in another projection while covering the same locations. The main difference is that the boundary of the shape cannot always be estimated using the corners. All
transform_bounds
is doing is taking the boundary, adding additional points along the edges of the boundary, re-projecting all of the points and taking the envelope of the new shape.Here is a function to add points between …