EPSG:4326 to EPSG:27700 conversion

102 views Asked by At

I am projecting some EPSG:4326 coordinates into EPSG:27700. The results are not what I am expecting, so I am wondering if there my code is wrong. Do I need to specify some additional datum in the pyproj install or is my reference website and expectation wrong?

The first code snippet is using the boundaries of an image layer. I am aware these exceed the EPSG:27700 boundaries.

from pyproj import Transformer
transformer = Transformer.from_crs("EPSG:4326", "EPSG:27700", always_xy=True) #always_xy maintains a lon,lat (x,y) order regardless of CRS
out_min = transformer.transform(-12, 48)
out_max = transformer.transform(5, 61)

print(out_min) #>>(-345474.8065004799, -162566.0277786366)
print(out_max) #>>(778063.4254725212, 1255449.1294913862) 

This second code snippet was my attempt to 'verify' that I had done things correctly, by supplying WGS84 bounds as input for the transformation and I expected to get the 'projected bounds' from https://epsg.io/27700 as output. But my results differ significantly.

#CHECK TRANSFORMATION
from pyproj import Transformer
transformer_check = Transformer.from_crs("EPSG:4326", "EPSG:27700", always_xy=True) #always_xy maintains a lon,lat (x,y) order regardless of CRS
check_out_min = transformer_check.transform(-9.01, 49.45)
check_out_max = transformer_check.transform(2.01, 61.01)

print(check_out_min) # >>(-111770.08085137716, -76351.09028675896) expected: -103976.3 -16703.87
print(check_out_max) # >>(616229.021742857, 1241818.517035355) expected: 652897.98 1199851.44

Any help is greatly appreciated!

0

There are 0 answers