Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@omgbbqhaxx omgbbqhaxx commented Mar 24, 2014

Google map v3 not accept shadow can you update this ?

@devloe

This comment has been minimized.

Copy link

@devloe 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
You can’t perform that action at this time.