Created
July 18, 2023 09:15
-
-
Save SofianeHamlaoui/1ec52273b25c4e5ee9dd2610f5b587ce to your computer and use it in GitHub Desktop.
Converting EPSG 4326 to EPSG 2154 using X,Y,Z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_coordinates(x, y, z): | |
src_crs = pyproj.CRS.from_epsg(4326) | |
dest_crs = pyproj.CRS.from_epsg(2154) | |
transformer = pyproj.Transformer.from_crs(src_crs, dest_crs, always_xy=True) | |
# Perform the transformation | |
dest_x, dest_y, dest_z = transformer.transform(x, y, z) | |
return dest_x, dest_y, dest_z | |
x = 4.858116239 | |
y = 45.764353552 | |
z = 169.06286470 | |
dest_x, dest_y, dest_z = convert_coordinates(x, y, z) | |
print(f"Converted Coordinates (EPSG 2154): {dest_x}, {dest_y}, {dest_z}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment