I am trying to project regular WGS84 coordinates to a local projected system (Azimuthal Equidistant), using meters and centered on the eiffel tower (as an exemple). I am using python 3.8.2 and pyproj 2.4.1 for that.
I tried to reproduce the method of Spacedman from [this post], but the results I get are clearly wrong ...
Here is my test code, trying to get the coordinates of Le Louvre Museum in that system :
# coding: utf8
import pyproj
def to_local(lon_angle, lat_angle, origin):
crs_wgs84 = pyproj.Proj('epsg:4326') # WGS84 input projection (angle)
crs_aeqd = pyproj.Proj(proj='aeqd', datum='WGS84', lon_0=origin[0], lat_0=origin[1], units='m') # Local Azimuthal Equidistant projection, centered on the 'origin' parameter
x, y = pyproj.transform(crs_wgs84, crs_aeqd, lon_angle, lat_angle)
return(x, y)
origin = (2.294473, 48.858440) # Eiffel tower in Paris
destination = (2.335769, 48.861062) # Le Louvre Museum
x, y = to_local(destination[0], destination[1], origin)
print(f'In local system centred on origin, destination has coordinates ({x}, {y})') # Result, in meters, should be around (3030, 290)
From what I roughly computed manually, I should get something like 3030 meters
as longitude and 290 meters
as latitude, both positive since Le Louvre is North-West from the Eiffel Tower, but here is the output :
> In local system centred on origin, destination has coordinates (5635219.051216577, -3788748.14149113)
I don't understand thoses values, what am I missing here ?
3030.09809, 292.40716
, but when I reverse the lon/lat of the destination, I get the same result as you do which is5635219.05122, -3788748.14149
. Looks like some kind of reversal of lat/lon occurs somewhere indeed...