Place connection lines

Draw labelled lines between a charging station and nearby cafes using PlacesModule.showConnections

View on GitHub
SDK 1.0.0-rc.7

Dashed lines join a charging station to nearby cafés, labelled with the straight-line distance, then with the driving time once the routes are in.

  • PlacesModule.create takes a connections config. Its label function reads each connection’s own fields, so relabelling is one more showConnections. Its color paints the lines, and their labels take a shade of it for the map’s light/dark theme.
  • showConnections draws each line and its label from a list of place id pairs, with no source or layer to set up.
  • show puts the station and the cafés on the map from the discoverPlaces responses.
  • formatDuration and formatDistance turn the raw seconds and metres into the label strings.

Related examples