Skip to content

Instantly share code, notes, and snippets.

@simonw
Created May 15, 2012 14:39
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save simonw/2702281 to your computer and use it in GitHub Desktop.
google-map-marker-with-shadow.js
/* Here's how to add a coloured marker to a Google Map with a shadow in the
right place.
The pin itself is dynamically generated using the Google Charts API,
documented here:
https://developers.google.com/chart/image/docs/gallery/dynamic_icons
Note however that this API was marked as deprecated on April 20th 2012
although it's not clear when or if it will be turned off.
*/
var shadowImage = new google.maps.MarkerImage(
'http://maps.gstatic.com/mapfiles/shadow50.png', null, null,
new google.maps.Point(10, 34)
);
var point = new google.maps.LatLng(lat, lng);
var marker = new google.maps.Marker({
position: point,
map: map,
title: name,
icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|3491FF|000000",
shadow: shadowImage
});
@omgbbqhaxx
Copy link

Google map v3 not accept shadow can you update this ?

@devloe
Copy link

devloe commented Apr 17, 2014

If you add "_withshadow" at the end of "d_map_pin_letter" you get a pin with a shadow, without the need add it programmatically.

d_map_pin_letter_withshadow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment