# Google Maps - Custom Markers



## oo.Berserker (Sep 22, 2007)

I have a Google map with the standard markers on a page, below is the code for the map (attachments are not working). Can anyone explain to me what and where I need to do to use a custom image for the marker please.

Thanks in advance.



function load()
{
//<![CDATA[

if (GBrowserIsCompatible()) {


// A function to create the marker and set up the event window
// Dont try to unroll this function. It has to be here for the function closure
// Each instance of the function preserves the contends of a different instance
// of the "marker" and "html" variables which will be needed later when the event triggers. 
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}

// Map controls 
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(45.91867663909007, 6.9358062744140625),11);


// Markers and info windows

var point = new GLatLng(45.88331671631865, 6.890144348144531);
var marker = createMarker(point,'<table width="200"><tr><td><span class="menuheaderblue"><a href="aiguille-du-midi-ski-lift-info.cfm">Aiguille du Midi</a></span></td></tr><tr><td height="5"></td</tr><tr><td><div align="justify"><span class="maptext">The Aiguille du Midi cable car takes you up to 3842m, where you have a breathtaking 360 degree panorama over the Mont Blanc Massif...<a href="aiguille-du-midi-ski-lift-info.cfm" style="font-size:10px;">More info</a></div></span></td></tr></table>')
map.addOverlay(marker);

var point = new GLatLng(45.934915539780576, 6.8286895751953125);
var marker = createMarker(point,'<table width="200"><tr><td><span class="menuheaderblue"><a href="brevent-ski-lift-info.cfm">Brevent</a></span></td></tr><tr><td height="5"></td</tr><tr><td><div align="justify"><span class="maptext">From the center of Chamonix you can access Brevent via the Planpraz gondola lift. Only a five minute walk up the hill...<a href="brevent-ski-lift-info.cfm" style="font-size:10px;">More info</a></div></span></td></tr></table>')
map.addOverlay(marker);

var point = new GLatLng(45.96093562515123, 6.871604919433594);
var marker = createMarker(point,'<table width="200"><tr><td><span class="menuheaderblue"><a href="flegere-ski-lift-info.cfm">Flegere</a></span></td></tr><tr><td height="5"></td</tr><tr><td><div align="justify"><span class="maptext">The ski area of Flegere can be accessed from the Flegere cable car in the village of Les Praz...<a href="flegere-ski-lift-info.cfm" style="font-size:10px;">More info</a></div></span></td></tr></table>')
map.addOverlay(marker);

var point = new GLatLng(46.00244696408296, 6.943359375);
var marker = createMarker(point,'<table width="200"><tr><td><span class="menuheaderblue"><a href="le-tour-ski-lift-info.cfm">Le Tour</a></span></td></tr><tr><td height="5"></td</tr><tr><td><div align="justify"><span class="maptext">The ski area of Le Tour and Vallorice is situated at the top of the valley and is furthest away from Chamonix, but its worth the journey...<a href="le-tour-ski-lift-info.cfm" style="font-size:10px;">More info</a></div></span></td></tr></table>')
map.addOverlay(marker);

var point = new GLatLng(45.941362020083915, 6.925506591796875);
var marker = createMarker(point,'<table width="200"><tr><td><span class="menuheaderblue"><a href="grands-montets-ski-lift-info.cfm">Grands Montets</a></span></td></tr><tr><td height="5"></td</tr><tr><td><div align="justify"><span class="maptext">Situated above Argentiere, the skiing area of Les Grands Montets can be accessed via the Lognan cable car and the Plan Joran chair lift...<a href="grands-montets-ski-lift-info.cfm" style="font-size:10px;">More info</a></div></span></td></tr></table>')
map.addOverlay(marker);




}

// display a warning if the browser was not compatible
else {
alert("Sorry, the Google Maps API is not compatible with this browser");
}

// This Javascript is based on code provided by the
// Blackpool Community Church Javascript Team
// http://www.commchurch.freeserve.co.uk/ 
// http://www.econym.demon.co.uk/googlemaps/

//]]>
}


----------

