Exemple #1
0
def util_geo_km(orig_lon, orig_lat, lon, lat):
    """
    Transform lon, lat to km with reference to orig_lon and orig_lat on the
    elliptic Earth.

    >>> util_geo_km(12.0, 48.0, 12.0, 48.0)
    (0.0, 0.0)
    >>> x, y = util_geo_km(12.0, 48.0, 13.0, 49.0)
    >>> print(round(x,7))
    73.9041417
    >>> print(round(y,7))
    111.1908262

    :param orig_lon: Longitude of reference origin
    :param orig_lat: Latitude of reference origin
    :param lat: Latitude to calculate relative coordinate in km
    :param lon: Longitude to calculate relative coordinate in km
    :return: x, y coordinate in km (in reference to origin)
    """
    # 2009-10-11 Moritz
    x = C.c_double(lon)
    y = C.c_double(lat)

    clibsignal.utl_geo_km(orig_lon, orig_lat, 0.0, C.byref(x), C.byref(y))
    return x.value, y.value
Exemple #2
0
def util_geo_km(orig_lon, orig_lat, lon, lat):
    """
    Transform lon, lat to km with reference to orig_lon and orig_lat on the
    elliptic Earth.

    >>> util_geo_km(12.0, 48.0, 12.0, 48.0)
    (0.0, 0.0)
    >>> x, y = util_geo_km(12.0, 48.0, 13.0, 49.0)
    >>> print(round(x,7))
    73.9041417
    >>> print(round(y,7))
    111.1908262

    :param orig_lon: Longitude of reference origin
    :param orig_lat: Latitude of reference origin
    :param lat: Latitude to calculate relative coordinate in km
    :param lon: Longitude to calculate relative coordinate in km
    :return: x, y coordinate in km (in reference to origin)
    """
    # 2009-10-11 Moritz
    x = C.c_double(lon)
    y = C.c_double(lat)

    clibsignal.utl_geo_km(orig_lon, orig_lat, 0.0, C.byref(x), C.byref(y))
    return x.value, y.value