Skip to content

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

Merged
benjaminrwilson merged 14 commits intomainfrom
add-gps-utm-converter
Apr 12, 2022
Merged

Add converter between AV2 city coordinate systems, and WGS84 and UTM#28
benjaminrwilson merged 14 commits intomainfrom
add-gps-utm-converter

Conversation

@senselessdev1
Copy link
Copy Markdown
Contributor

PR Summary

Adds converter between AV2 city coordinate systems, and WGS84 and UTM, as requested by argoverse/argoverse-api#290.

Testing

In order to ensure this PR works as intended, it is:

  • unit tested.
  • other or not applicable (additional detail/rationale required)

Compliance with Standards

As the author, I certify that this PR conforms to the following standards:

  • Code changes conform to PEP8 and docstrings conform to the Google Python style guide.
  • A well-written summary explains what was done and why it was done.
  • The PR is adequately tested and the testing details and links to external results are included.



# All are North UTM zones (Northern hemisphere)
UTM_ZONE_MAP = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
UTM_ZONE_MAP = {
UTM_ZONE_MAP: Final[Dict[CityName, int]] = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks, updated now.



# as (lat, long) tuples
CITY_ORIGIN_LATLONG_DICT = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
CITY_ORIGIN_LATLONG_DICT = {
CITY_ORIGIN_LATLONG_DICT: Final[Dict[CityName, Tuple[float, float]]] = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks, updated now.

@@ -0,0 +1,105 @@
# <Copyright 2022, Argo AI, LLC. Released under the MIT license.>

"""Utilities for converting AV2 city coordinates to UTM or WGS84 coordinate systems."""
Copy link
Copy Markdown
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
Copy Markdown
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.

}


def convert_gps_to_utm(lat: float, long: float, city_name: CityName) -> Tuple[float, float]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I understand that long is common in the GIS community, but I think this is a bit confusing with the numerical type, long. Perhaps we could use lon?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. I switched to longitude, since I think it's not much longer, and may be clearer.

return points_utm


def convert_city_coords_to_wgs84(points_city: Union[NDArrayFloat, NDArrayInt], city_name: CityName) -> NDArrayFloat:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def convert_city_coords_to_wgs84(points_city: Union[NDArrayFloat, NDArrayInt], city_name: CityName) -> NDArrayFloat:
def convert_city_coords_to_wgs84(points_xy_city: Union[NDArrayFloat, NDArrayInt], city_name: CityName) -> NDArrayFloat:

Prefer xy to make it clear these points are 2D.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit biased towards what we have, since I think points_xy_city is maybe getting a bit too long for a name.

@benjaminrwilson benjaminrwilson merged commit 99708b4 into main Apr 12, 2022
@benjaminrwilson benjaminrwilson deleted the add-gps-utm-converter branch April 12, 2022 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants