0

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.

4
  • Does this answer your question? I am getting the wrong result for north coordinate
    – snowman2
    Commented Apr 29, 2021 at 17:09
  • @snowman2 not at all the question you link relates to WGS84 which is easily supported by pyproj. My question relates to a different datum for which I struggle finding how to use within the library.
    – Eskapp
    Commented Apr 29, 2021 at 17:11
  • 1
    Okay, I noticed the comma in your PROJ string and one of the answers discusses that.
    – snowman2
    Commented Apr 29, 2021 at 17:48
  • I see, tried without as well. Same issue.
    – Eskapp
    Commented Apr 29, 2021 at 17:49

1 Answer 1

2

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
4
  • For me this produces: Internal Proj Error: proj_create: datum of wrong type May I ask which version of Pyproj you are using, the error I get makes me think that a version issue could be the reason for my problem
    – Eskapp
    Commented Apr 29, 2021 at 18:55
  • I used PROJ 8.0 and pyproj 3.0.1 (installed with conda-forge)
    – snowman2
    Commented Apr 29, 2021 at 20:30
  • I use pyproj 3.0.0.post1, I will upgrade. Maybe this is why. However I could make things work with what I wrote in the Update2 section of my question.
    – Eskapp
    Commented Apr 30, 2021 at 17:47
  • I think what you have in your update is much better!
    – snowman2
    Commented Apr 30, 2021 at 20:29

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.