Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Support extraction of latitude and longitude degrees from LatLng class #39

Open

Description

@kuanb

Need:
Given an instantiated LatLng object, I should be able to extract the latitude and longitude in degrees.

Currently, this does not appear to be possible (please correct me if I am wrong, of course!).

Example:
I want to get the geometry of a given S2 cell's bounding box. I first convert from a cellId to a rectangle bounding box:

rb = s2sphere.Cell(s2sphere.CellId(cell_id)).get_rect_bound()

I can then get the lower coordinates via:

corner_1 = rb.lo()

If I submit just the variable, the repl will log: LatLng: 38.62134636194326,-90.20102331066352

I would like that lat and long value. Unfortunately, all values that are emitted appear to be converted to Angle objects.

Activity

  1. jeremyh3 commented on May 17, 2023

    @jeremyh3

    This seems to already work for me:

    import s2sphere as s2
    
    v = s2.LatLng.from_degrees(10.0,20.0)
    print(f"{v.lat().degrees},{v.lon().degrees}")
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions