I am using google-map-react to render a google map, for a path, using GPS positions. At the moment, I am rendering a path in a single colour.
I would like to change the colour of the line, based on speed. Is there a way to update the colour of the path samples, based on some criteria?
At the moment, I only see how to set the colour for the whole path:
var flightPath = new maps.Polyline(
{
path: path,
geodesic: true,
strokeColor: "#FF0033",
strokeOpacity: 2,
strokeWeight: 4
});
flightPath.setMap(map);
With path
being specified as:
const path = places ? places.map((event) => {
return {
lat: event.position.lat,
lng: event.position.lng
}
}) : [];
Is it possible to set each event in the path's colour?