coure2011
coure2011

Reputation: 42404

Google Maps: showing a local image for a marker

How do I show a local image for a GMarker? I am using v2. Code sample

var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image = '/Images/marker/mr.png';
markerOptions = { icon: blueIcon };

map.setCenter(point, 3);
var marker = new GMarker(point, markerOptions);

Its not working...

Upvotes: 1

Views: 4077

Answers (2)

Guffa
Guffa

Reputation: 700152

What's local to the map page is the Google Maps site itself, so if you want to use an image from your site, you have to provide the full URL for it.

Upvotes: 1

ScottE
ScottE

Reputation: 21630

If you haven't seen the v2 docs, here is a link:

http://code.google.com/apis/maps/documentation/javascript/v2/overlays.html#Custom_Icons

Also, are you actually adding it to the map, or have you omitted that from your code?

Here is a full example:

http://code.google.com/apis/maps/documentation/javascript/v2/examples/icon-simple.html

Upvotes: 0

Related Questions