Place connection lines
Draw labelled lines between a charging station and nearby cafes using PlacesModule.showConnections
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.createtakes aconnectionsconfig. Itslabelfunction reads each connection’s own fields, so relabelling is one moreshowConnections. Itscolorpaints the lines, and their labels take a shade of it for the map’s light/dark theme.showConnectionsdraws each line and its label from a list of place id pairs, with no source or layer to set up.showputs the station and the cafés on the map from thediscoverPlacesresponses.formatDurationandformatDistanceturn the raw seconds and metres into the label strings.
Related examples
EV chargers nearby
Fast charging stations near one location, filtered by connector and power, with each station's connectors on click
Getting Started
Electric Vehicles
Search and Geocoding
Places and POIs
Web
Add Stops to Route
Find stops along a route within a one-minute detour and insert them all at optimal positions in a single call.
Getting Started
Routing
Search and Geocoding
Electric Vehicles
Utilities
Web
Show your own GeoJSON as places
Fetch a council's listed buildings as GeoJSON and pin each one, named, on the map
Getting Started
Bring Your Own Data
Places and POIs
Web
EV charging stations search
Interactive exploration of EV charging stations, their connectors and charging points
Playground
Search and Geocoding
Places and POIs
Electric Vehicles
Plugins
Web