Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add converter between AV2 city coordinate systems, and WGS84 and UTM #28

Merged
merged 14 commits into from
Apr 12, 2022
Prev Previous commit
Next Next commit
add Final type annotations and @unique decorator
  • Loading branch information
John Lambert committed Mar 27, 2022
commit af63ba1211dfc3ef3e7f4a836f18ecfcf3487e2f
9 changes: 5 additions & 4 deletions src/av2/geometry/utm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"""Utilities for converting AV2 city coordinates to UTM or WGS84 coordinate systems."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add some information about these two coordinate systems here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added some references.


from enum import Enum
from typing import Tuple, Union
from typing import Dict, Final, Tuple, Union

import numpy as np
from pyproj import Proj

from av2.utils.typing import NDArrayFloat, NDArrayInt


benjaminrwilson marked this conversation as resolved.
Show resolved Hide resolved
@unique
class CityName(str, Enum):
"""Abbreviations of names of cities featured in Argoverse 2."""

Expand All @@ -23,7 +24,7 @@ class CityName(str, Enum):


# All are North UTM zones (Northern hemisphere)
UTM_ZONE_MAP = {
UTM_ZONE_MAP: Final[Dict[CityName, int]] = {
CityName.ATX: 14,
CityName.DTW: 17,
CityName.MIA: 17,
Expand All @@ -34,7 +35,7 @@ class CityName(str, Enum):


# as (lat, long) tuples
CITY_ORIGIN_LATLONG_DICT = {
CITY_ORIGIN_LATLONG_DICT: Final[Dict[CityName, Tuple[float, float]]] = {
CityName.ATX: (30.27464237939507, -97.7404457407424),
CityName.DTW: (42.29993066912924, -83.17555750783717),
CityName.MIA: (25.77452579915163, -80.19656914449405),
Expand Down Expand Up @@ -78,7 +79,7 @@ def convert_city_coords_to_utm(points_city: Union[NDArrayFloat, NDArrayInt], cit
# get (easting, northing) of origin
origin_utm = convert_gps_to_utm(lat=lat, long=long, city_name=city_name)

points_utm = points_city + origin_utm
points_utm: NDArrayFloat = points_city + origin_utm
return points_utm


Expand Down