TransWikia.com

Converting latitude/longitude to UTM using GDA2020 datum with Pyproj

Geographic Information Systems Asked by Eskapp on June 9, 2021

I want to convert a pair of (latitude, longitude) values that represent a location in Australia to UTM values within the GDA2020 datum.

I tried to do something similar to what I usually do with North American (latitude, longitude) pairs with the library Pyproj in Python. In the NAD83 datum, the conversion runs fine doing:

from pyproj import Proj
proj_utm = Proj('proj=utm +zone=18T, +south +ellps=GRS80 +datum=NAD83 +units=m +no_defs')
utm_values = proj_utm(-73.665, 45.455)

Let’s say that now, I want to convert the (latitude, longitude) pair: (-27.45745, 153.05715) to UTM in the GDA2020 datum. The UTM zone is 56J.

proj_utm = Proj('proj=utm +zone=16J, +south +ellps=GRS80 +datum=GDA2020 +units=m +no_defs')

returns the following error:

pyproj.exceptions.CRSError: Invalid projection: +proj=utm +zone=56J, +south +ellps=GRS80 +datum=GDA2020 +units=m +no_defs +type=crs: (Internal Proj Error: proj_create: Error -9 (unknown elliptical parameter name))

The only things I have found online so far are about how to convert from one CRS to another. It is possible that my understanding is wrong but my understanding is that the latitude longitude I get is already expressed in the GDA2020 datum and the only thing that I want to do is to have the same location expressed in UTM in this same datum. I know about the utm package. It is a bidirectional WGS84 converter between lat/lng and UTM but I am afraid to use it and to end up with a gap of 1 meter or more in my data.

Update: I think my logic is inaccurate, I have trouble to pinpoint which part is inaccurate. GDA2020 seems to be in meters https://epsg.io/7842 but it seems to have refinements for some specific utm zones (GDA2020 / MGA zone 56 for instance) https://epsg.io/7856.
On the other hand, It seems that some lat, lng can be given in the NAD83 datum in North America as the unit is degrees https://epsg.io/4269. What is the Australian datum most precise for lat/lng in this context might be part of my confusion.

Update2 after further readings:

GDA2020 is based on the reference frame ITRF2014 (source)
ITRF2014 can be considered equal at a 10cm margin to WGS84 (no conversion exists). Source
Therefore, if I get a latitude/longitude pair in Australia given to me by a system that claims using GDA2020 reference system in their data, I can consider it to be given in ITRF2014 which is equivalent to WGS84.

From there, I found that I can either use the definition of a CRS in Pyproj as suggested by @snowman2 or define a transformer like:

transformer = Transformer.from_crs(9000, 7856)
lat, long = -27.45745, 153.05715
x, y = transformer.transform(lat, long)

EPSG 9000 is ITRF2014 https://epsg.io/9000
EPSG 7856 is GDA2020 / MGA zone 56 https://epsg.io/7856 which in my current understanding is a realization of UTM that is more precise for Australia given the continental drift it undergoes at a pace of about 7cm/year.

One Answer

https://pyproj4.github.io/pyproj/stable/build_crs.html

from pyproj.crs import GeographicCRS, ProjectedCRS
from pyproj.crs.coordinate_operation import UTMConversion

proj_crs = ProjectedCRS(
    conversion=UTMConversion("16", "S"), geodetic_crs=GeographicCRS(datum="GDA2020")
)

This produces:

<Projected CRS: {"$schema": "https://proj.org/schemas/v0.2/projjso ...>
Name: undefined
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- undefined
Coordinate Operation:
- name: UTM zone 16S
- method: Transverse Mercator
Datum: Geocentric Datum of Australia 2020
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

Answered by snowman2 on June 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP