Use an SVG for a marker

4,377 views
Skip to first unread message

V

unread,
Nov 2, 2010, 12:10:57 PM11/2/10
to Google Maps JavaScript API v3
i know it's possible to add svg overlays to google maps. i'm wondering
if you can use svg files as markers. i tried setting it just like you
would a png or jpg file, but nothing shows up:

var image = new google.maps.MarkerImage('buses/images/marker.svg');
var marker2 = new google.maps.Marker({
position: coord,
map:map,
icon: image
});

also tried:
var marker2 = new google.maps.Marker({
position: coord,
map:map,
icon: "buses/images/marker.svg"
});

am i approaching this the wrong way?

thanks.

Chad Killingsworth

unread,
Nov 2, 2010, 2:18:48 PM11/2/10
to Google Maps JavaScript API v3
The marker is an image, so you are setting an html image tag source to
be an SVG file. That's just not going to work.

You'd need a custom marker implementation. Try looking at RichMarker
in the utility library: http://code.google.com/p/google-maps-utility-library-v3/wiki/Libraries

Chad KIllingsworth
Reply all
Reply to author
Forward
0 new messages