Exemple #1
0
def h3d_to_h3s(d: int) -> int:
    """
    Returns restored h3 hex index

    :param d: h3 distilled numeric (int) representation
    :returns: h3 hex (str) representation as returned by the h3.geo_to_h3()
    """
    return h3.h3_to_string(h3d_to_h3h(d))
Exemple #2
0
def placekey_to_h3(placekey):
    """
    Convert a Placekey string into an H3 string.

    :param placekey: Placekey (string)
    :return: H3 (string)

    """
    _, where = _parse_placekey(placekey)
    return h3.h3_to_string(_decode_to_h3_int(where))
Exemple #3
0
    def _emit(self, topic: str, event: Event):
        details = unpack_event_details(topic, event)

        if topic == "analytics.vehicle-distribution":
            data = {
                "geocell": h3.h3_to_string(details.geocell),
                "count": details.count,
            }
        elif topic == "analytics.delay-distribution":
            data = {
                "geocell": h3.h3_to_string(details.geocell),
                "p50": details.percentile50th,
                "p90": details.percentile90th,
                "p99": details.percentile99th,
            }
        elif topic == "analytics.flow-direction":
            data = {
                "edge": h3.h3_to_string(details.geocells_edge),
                "count": details.count,
            }
        elif topic == "analytics.final-stop-distribution":
            data = {
                "geocell": h3.h3_to_string(details.geocell),
                "count": details.count,
            }
        elif topic == "analytics.emergency-stop-detection-streaming":
            data = {
                "veh_type": VehicleType.Name(details.vehicle_type).lower(),
                "lat": details.latitude,
                "lon": details.longitude,
                "max_dec": details.max_deceleration,
                "speed_diff": details.speed_diff,
            }
        else:
            return

        self.socketio.emit(topic, {
            "timestamp": event.event_timestamp.ToMilliseconds(),
            "data": data
        })
def test_str_int_convert():
    s = '8928308280fffff'
    i = h3.string_to_h3(s)

    assert h3.h3_to_string(i) == s