I'm trying to project from ED50 31N to WGS 84. I'm using script below but when I generate the outputs they are inverted from the coordinates I would expect. I expect x_out to be 4.031819616199967 and y_out to be 58.63423101793458 and not vice-versa (what python returns for me). I'm running this with pyproj 2.6.1. When I use an online converter (e.g. https://epsg.io/transform#s_srs=23031&t_srs=4326&x=560000.0000000&y=6500000.0000000) I do get the expected coordinates. Any idea why they are inverted with this script?

Python 3.8.2 (default, Apr 27 2020, 15:53:34) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>> from pyproj import Transformer
>>> in_EPSG = 'epsg:23031'
>>> out_EPSG = 'epsg:4326'
>>> transformer = Transformer.from_crs(in_EPSG, out_EPSG)

>>> x_in = 560000
>>> y_in = 6500000
>>> x_out,y_out = transformer.transform(x_in,y_in)

>>> print(x_out)
>>> print(y_out)

1 Answer 1


It appears you are running into axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6

This should restore the expected order:

transformer = Transformer.from_crs(in_EPSG, out_EPSG, always_xy=True)
  • Thank you, that did the trick!
    – Gojira1929
    Jul 6, 2020 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.