How to use keplergl - 2 common examples

To help you get started, we’ve selected a few keplergl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xoolive / traffic / traffic / plugins / kepler.py View on Github external
def _onload():
    setattr(Airspace, "kepler", airspace_kepler)
    setattr(Flight, "kepler", flight_kepler)
    setattr(Traffic, "kepler", traffic_kepler)
    setattr(KeplerGl, "add_data", map_add_data)
github xoolive / traffic / traffic / plugins / kepler.py View on Github external
"id": flight.flight_id
                if flight.flight_id is not None
                else flight.aircraft,
                "wkt_string": dumps(flight.shape),
                "icao24": flight.icao24,
                "callsign": flight.callsign,
                "registration": flight.registration,
                "start": f"{flight.start:%Y-%m-%d %H:%M:%S}",
                "stop": f"{flight.stop:%Y-%m-%d %H:%M:%S}",
            }
            for flight in traffic
        ]
    )


_old_add_data = KeplerGl.add_data


def map_add_data(_map, data, *args, **kwargs):
    if any(isinstance(data, c) for c in (Airspace, Flight, Traffic)):
        layer = data.kepler()
        return _old_add_data(_map, layer, *args, **kwargs)

    if any(isinstance(data, c) for c in (list, Generator)):
        layer = dict(
            type="FeatureCollection", features=[elt.kepler() for elt in data]
        )
        return _old_add_data(_map, layer, *args, **kwargs)

    # convenient for airports, navaids, etc.
    if hasattr(data, "data"):
        data = data.data

keplergl

This is a simple jupyter widget for kepler.gl, an advanced geospatial visualization tool, to render large-scale interactive maps.

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis