Hi,
I can't seem to get custom markers to show when I have multiple
markers/info windows. I only need one type of custom marker. Can
anyone see why this code doesn't use the custom marker (it just uses
the default 'red droplet' icon):
function initialize() {
if (GBrowserIsCompatible()) {
function
createMarker(point,html) {
var marker =
new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var map = new
GMap2(document.getElementById("map_canvas"));
map.setCenter(new
GLatLng(54.7753459, -3.9550781), 5);
map.setUIToDefault();
var myIcon = new
GIcon(G_DEFAULT_ICON);
myIcon.image =
"/css/img/icon.png";
myIcon.shadow =
"/css/img/shadow.png";
myIcon.iconSize = new
GSize(16, 16);
myIcon.shadowSize = new
GSize(37, 14);
//
myIcon.iconAnchor = new GPoint(6, 20);
//
myIcon.infoWindowAnchor = new GPoint(5, 1);
// Set up our
GMarkerOptions object
markerOptions = {
icon:myIcon};
var point = new GLatLng(51.474674090980386,-3.2000041007995605);
var marker = createMarker(point,'Test 1');
map.addOverlay(marker, markerOptions);
var point = new GLatLng(51.514992241447835,-0.06823539733886719);
var marker = createMarker(point,'Test 2');
map.addOverlay(marker, markerOptions);
var point = new GLatLng(53.4807125,-2.2343765);
var marker = createMarker(point,'Test 3');
map.addOverlay(marker, markerOptions);
var point = new GLatLng(51.446839389143946,-2.6102828979492188);
var marker = createMarker(point,'Test 4');
map.addOverlay(marker, markerOptions);
}
}
Thanks for any pointers!
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.