Map and Table Dashboard

To use maps, you need to obtain and install either a Google Maps or MapBox api key before maps can be used. See Using Google Maps and OpenStreetMaps Tiles with StreamLab below for more information. The Map and Table dashboard displays two frames:

  1. A table listing all data from the stream.
  2. A World Events map visualization panel displaying the locations of latitude-longitude pairs.

You can remove or add panels through the Dashboards menu, available by clicking the SQLstream icon in the upper right corner of the panel). You can also rearrange the panels' layout.

By default, the Map panel is generated as an World Events map visualization panel.

You can also switch to the Pan and Zoom map, which offers a wider range of options than the World Events visualization panel.

To generate a Map and Table dashboard:

  1. Select the Map and Table tab in the Custom Dashboard commands.

  2. Select columns for Latitude and Longitude. In order for the map to work properly, you need to verify that these columns map to real-world locations (the person managing your data should be able to verify this for you).

  3. Select a column for Value. This text appears when you mouse over an event on the map.

  4. Select a column for ID. StreamLab uses the id column to group associated events.

  5. If desired, select a column for Key. You can use this to color-code events in the Pan and Zoom map.

  6. Click the + icon to add the suggestion to the Script.

  7. Click the Dashboard icon in the script. The icon appears red for custom dashboards.

  8. The Map and Table dashboard opens.

Once the dashboard opens, you can modify it with panel preferences or by modifying the layout.

Switching to the Pan and Zoom Panel

The Pan & Zoom Map visualization panel offers a wider range of options than the World Events visualization panel.

To switch to the Pan & Zoom Map visualization pane:

  1. Click the title for the current visualization panel:
  2. In the Select Panel dialog box, select Geo > Pan & Zoom Map and click Select.
    The Pan & Zoom Map visualization panel opens. You can change preferences for the panel by clicking the Panel Preferences icon in the upper right corner of the panel.

Preferences include:

  • Maximum time
  • Maximum Events. Here, you select the maximum number of events to display at once
  • Whether or not to cluster events. If you deselect this option, all events appear individually.
  • Google Map Style. Here you can select from Roadmap, Satellite, Terrain, or hybrid.
  • Diameter Formula. Here you can use the name of a column, or use that column in a mathematical formula, such as v_alue10_.
  • Diameter Is. Here you choose pixels or meters for the Diameter Formula.
  • Display Mode. Choose from the following
    1. Show all events displays all events up to the maximum defined in Maximum Events, no matter how old.
    2. Show all events and trail displays all events, along with a line connecting an event to its previous location. This is useful for moving vehicles, for example.
  1. Show most recent event displays only events within the maximum time.
  2. Show most recent and trail displays only events within the maximum time, along with a line connecting an event to its previous location. This is useful for moving vehicles, for example.
    1. Event Label lets you add a custom label to your map. To do so, enter the name of one of your columns enclosed in a <%= %>, such as <%= title %>.
    2. Key Color Map lets you customize how events, markers, and trails appear.

Using Google Maps and OpenStreetMaps Tiles with StreamLab

To use maps, you need to obtain and install either a Google Maps or MapBox api key before maps can be used.

If you are using the the Pan and Zoom map visualization, StreamLab and s-Dashboard require a Google Maps API key. To retrieve an API key, please visit the following link: https://developers.google.com/maps/documentation/javascript/tutorial#api_key.

Once you have a Google Maps API key, you need to restart StreamLab to incorporate it. To do so when launching StreamLab from the command line, use a -m flag, as in:

-m google:AGzaSyrDBVfuWtaa40S1pM8U-0YED3ONjvq6-7mFZ

To do so when launching StreamLab using the ‘Start Streamlab Server’ icon, right-click on the desktop ‘Start Streamlab Server’ icon, select Properties, and add the -m option to the end of the command.

You can now use the Pan and Zoom map visualization with full functionality.

Using StreamLab with OpenStreetMaps

To use OpenStreetMaps tiles, you need a Mapbox id. To design a map, go to https://www.mapbox.com/ and sign up and design the map they want.

Each map has a map id. This gets used in the -m option preceded by ‘mapbox:’, as in:

   -m mapbox:myserver.jeo4y40c

All StreamLab maps will use the same tile set. In order to use a different tile set, you need to restart StreamLab with a different Mapbox id.

Setting Map Service in Environment

You can also set the map service in /etc/default/streamlabd, by setting STREAMLAB_MAP_SERVICE to ‘google:’ or ‘mapbox:’.