Created
May 15, 2012 14:39
-
-
Save simonw/2702281 to your computer and use it in GitHub Desktop.
google-map-marker-with-shadow.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 | |
}); |
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
Google map v3 not accept shadow can you update this ?