-
Notifications
You must be signed in to change notification settings - Fork 78
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
Changes from 1 commit
094616d
c844ffd
d690272
fd6e0cc
817a098
925ab94
33741b4
af63ba1
afd0c12
918c421
5d29a1d
f811951
eecae32
117f44f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ | |||||
|
||||||
"""Utilities for converting AV2 city coordinates to UTM or WGS84 coordinate systems.""" | ||||||
|
||||||
from enum import Enum | ||||||
from enum import unique, Enum | ||||||
from typing import Dict, Final, Tuple, Union | ||||||
|
||||||
import numpy as np | ||||||
|
@@ -69,29 +69,29 @@ def convert_city_coords_to_utm(points_city: Union[NDArrayFloat, NDArrayInt], cit | |||||
"""Convert city coordinates to UTM coordinates. | ||||||
|
||||||
Args: | ||||||
points_city: 2d coordinates, representing query points in the city coordinate frame. | ||||||
points_city: (N,2) array, representing 2d query points in the city coordinate frame. | ||||||
city_name: name of city, where query points are located. | ||||||
|
||||||
Returns: | ||||||
Points in the UTM coordinate system, as (easting, northing). | ||||||
Array of shape (N,2), representing points in the UTM coordinate system, as (easting, northing). | ||||||
""" | ||||||
lat, long = CITY_ORIGIN_LATLONG_DICT[city_name] | ||||||
# get (easting, northing) of origin | ||||||
origin_utm = convert_gps_to_utm(lat=lat, long=long, city_name=city_name) | ||||||
|
||||||
points_utm: NDArrayFloat = points_city + origin_utm | ||||||
points_utm: NDArrayFloat = points_city.astype(float) + np.array(origin_utm, dtype=float) # type: ignore | ||||||
return points_utm | ||||||
|
||||||
|
||||||
def convert_city_coords_to_wgs84(points_city: Union[NDArrayFloat, NDArrayInt], city_name: CityName) -> NDArrayFloat: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit biased towards what we have, since I think |
||||||
"""Convert city coordinates to WGS84 coordinates. | ||||||
|
||||||
Args: | ||||||
points_city: 2d coordinates, representing query points in the city coordinate frame. | ||||||
points_city: (N,2) array, representing 2d query points in the city coordinate frame. | ||||||
city_name: name of city, where query points are located. | ||||||
|
||||||
Returns: | ||||||
Points in the WGS84 coordinate system, as (lat, long). | ||||||
Array of shape (N,2), representing points in the WGS84 coordinate system, as (lat, long). | ||||||
""" | ||||||
points_utm = convert_city_coords_to_utm(points_city, city_name) | ||||||
|
||||||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.