def decode_exactly(code, bits_per_char=6):
    """Decode a geohash on a hilbert curve as a lng/lat position with error-margins

    Decodes the geohash `code` as a lng/lat position with error-margins. It assumes,
    that the length of `code` corresponds to the precision! And that each character
    in `code` encodes `bits_per_char` bits. Do not mix geohashes with different
    `bits_per_char`!

    Parameters:
        code: str           The geohash to decode.
        bits_per_char: int  The number of bits per coding character

    Returns:
        Tuple[float, float, float, float]:  (lng, lat, lng-error, lat-error) coordinate for the geohash.
    """
    assert bits_per_char in (2, 4, 6)

    if len(code) == 0:
        return 0., 0., _LNG_INTERVAL[1], _LAT_INTERVAL[1]

    bits = len(code) * bits_per_char
    level = bits >> 1
    dim = 1 << level

    code_int = decode_int(code, bits_per_char)
    if CYTHON_AVAILABLE and bits <= MAX_BITS:
        x, y = hash2xy_cython(code_int, dim)
    else:
        x, y = _hash2xy(code_int, dim)

    lng, lat = _int2coord(x, y, dim)
    lng_err, lat_err = _lvl_error(level)  # level of hilbert curve is bits / 2

    return lng + lng_err, lat + lat_err, lng_err, lat_err
def decode_exactly ( code , bits_per_char = 6 ) : assert bits_per_char in ( 2 , 4 , 6 ) if len ( code ) == 0 : return 0. , 0. , _LNG_INTERVAL [ 1 ] , _LAT_INTERVAL [ 1 ] bits = len ( code ) * bits_per_char level = bits >> 1 dim = 1 << level code_int = decode_int ( code , bits_per_char ) if CYTHON_AVAILABLE and bits <= MAX_BITS : x , y = hash2xy_cython ( code_int , dim ) else : x , y = _hash2xy ( code_int , dim ) lng , lat = _int2coord ( x , y , dim ) lng_err , lat_err = _lvl_error ( level ) return lng + lng_err , lat + lat_err , lng_err , lat_err
Decode a geohash on a hilbert curve as a lng/lat position with error-margins

    Decodes the geohash `code` as a lng/lat position with error-margins. It assumes,
    that the length of `code` corresponds to the precision! And that each character
    in `code` encodes `bits_per_char` bits. Do not mix geohashes with different
    `bits_per_char`!

    Parameters:
        code: str           The geohash to decode.
        bits_per_char: int  The number of bits per coding character

    Returns:
        Tuple[float, float, float, float]:  (lng, lat, lng-error, lat-error) coordinate for the geohash.