Skip to content

geo

geo #

Geographic fixes in the shared world: a Location's metres from an anchor.

The world every reconstruction shares is metric and y-up; a site pins it to the Earth by choosing an anchor Location as its origin with x north, y up and z east. local_offset places any other location on the local tangent plane through that anchor, from the WGS-84 metres per degree of latitude and longitude at the anchor's latitude — exact to the centimetre over the hundreds of metres a capture site spans.

F = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, -1.0, 0.0]]) module-attribute #

A device's north-west-up frame to the shared north-up-east world.

local_offset(location, anchor) #

location's tangent-plane offset from anchor in the y-up world: north, up, east.

Source code in capturegraph-recipes/capturegraph_recipes/sfm/alignment/geo.py
def local_offset(location: cg.Location, anchor: cg.Location) -> np.ndarray:
    """``location``'s tangent-plane offset from ``anchor`` in the y-up world: north, up, east."""
    latitude = math.radians(anchor.latitude)
    meters_per_degree_latitude = (
        111132.92
        - 559.82 * math.cos(2 * latitude)
        + 1.175 * math.cos(4 * latitude)
        - 0.0023 * math.cos(6 * latitude)
    )
    meters_per_degree_longitude = (
        111412.84 * math.cos(latitude)
        - 93.5 * math.cos(3 * latitude)
        + 0.118 * math.cos(5 * latitude)
    )
    north = (location.latitude - anchor.latitude) * meters_per_degree_latitude
    east = (location.longitude - anchor.longitude) * meters_per_degree_longitude
    up = location.altitude_meters - anchor.altitude_meters
    return np.array([north, up, east])