Skip to content

Instantly share code, notes, and snippets.

@kevinsimper
Created June 19, 2020 23:22
Show Gist options
  • Save kevinsimper/c1fde0de43982bd1d8f618a9f63de58d to your computer and use it in GitHub Desktop.
Save kevinsimper/c1fde0de43982bd1d8f618a9f63de58d to your computer and use it in GitHub Desktop.
Google Maps marker with SVG
const color = car.isReserved ? "#ff9900" : "#" + car.vehicleState.color;
const icon = {
path:
"m30,65c-8,-11 -17,-27 -18,-34c-1,-5 2,-13 7,-19c11,-13 34,-10 41,5c4,9 4,13 1,23c-3,8 -18,31 -22,33c-1,0 -5,-3 -9,-8z",
fillColor: color,
fillOpacity: 0.9,
scale: 0.7,
strokeColor: "#fff",
strokeWeight: 3,
anchor: new google.maps.Point(40, 74),
};
const marker = new google.maps.Marker({
position: { lat: car.lat, lng: car.lon },
map: mapVar,
icon,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment