aisdb.web_interface module
- aisdb.web_interface.client_url(host: str = 'localhost', http_port: int = 3000, visualearth: bool = False) str[source]
construct the URL serving the web client map interface
- aisdb.web_interface.serialize_track_json(track) -> (<class 'bytes'>, <class 'bytes'>)[source]
serializes a single track dictionary to JSON format encoded as UTF8
- aisdb.web_interface.visualize(tracks, domain=None, visualearth: bool = False, open_browser: bool = True, host: str = 'localhost', http_port: int = 3000, ws_port: int = 9924)[source]
Display tracks using the web interface.
Starts the web client HTTP server in a separate process, and serves track data via websocket.
If a domain object is given, zone polygons will be drawn on the map from domain zone geometries.
If visualearth is True, microsoft visual earth map tiles will be used for the map background.
If open_browser is True, python will attempt to open the web application in a new tab using the default browser.
The host, http_port, and ws_port arguments set the bind address for the HTTP asset server and the websocket data server. Defaults serve HTTP on localhost:3000 and websocket data on localhost:9924.
To customize the color of each vessel track, set the ‘color’ value to a color string or RGB value string:
>>> def color_tracks(tracks): ... for track in tracks: ... track['color'] = 'red' or 'rgb(255,0,0)' ... yield track ... >>> tracks = [ ... {'mmsi': 204242000, 'lon': [-8.931666], 'lat':[41.45], 'time': [1625176725]}, ... {'mmsi': 204814000, 'lon': [-25.668333], 'lat': [37.736668], 'time': [1625147353]}, ... ] >>> tracks_colored = color_tracks(tracks)