Thanks for the quick reply. I've done what you've suggested but alas,
it is still not working. I'm not really sure how to proceed. I've
placed the .js file below. If you can find any problems I would be
very appreciative.
Thanks!
-David
//<![CDATA[
var map;
var markersfoo = [];
var myIcon;
function initialize() {
if(GBrowserIsCompatible()) {
map = new GMap2(document.getElementById('map'));
map.setCenter(new GLatLng( 39.9,-105.6), 4);
map.addControl(new GLargeMapControl());
var myIcon = new GIcon();
myIcon.image = 'markers/image.png';
myIcon.shadow = 'markers/shadow.png';
myIcon.myIconSize = new GSize(46,38);
myIcon.shadowSize = new GSize(65,38);
myIcon.myIconAnchor = new GPoint(0,38);
myIcon.infoWindowAnchor = new GPoint(23,0);
myIcon.printImage = 'markers/printImage.gif';
myIcon.mozPrintImage = 'markers/mozPrintImage.gif';
myIcon.printShadow = 'markers/printShadow.gif';
myIcon.transparent = 'markers/transparent.png';
myIcon.imageMap =
[19,0,21,1,22,2,23,3,24,4,25,5,26,6,26,7,27,8,27,9,27,10,27,11,27,12,27,13,27,14,27,15,36,16,39,17,41,18,42,19,42,20,43,21,43,22,44,23,44,24,44,25,43,26,43,27,42,28,42,29,41,30,40,31,38,32,37,33,35,34,33,35,30,36,26,37,9,37,8,36,8,35,7,34,6,33,5,32,5,31,5,30,5,29,5,28,5,27,6,26,5,25,4,24,3,23,2,22,1,21,1,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,1,7,1,6,2,5,3,4,4,3,5,2,6,1,8,0];
GDownloadUrl("custommarkers.xml",processMyData); //Calls the
xml-data and sends it to processMYyData-function
}
}
function createMarker(point, title, street_address, city,
state, zip_code, telephone) {
var markerOnMap = new
GMarker(point, {icon: myIcon});
var html = "<b>" +title +"</b><p><b>" +
street_address
+"<br />" + city +"<br />" + state + zip_code +"</b></p><p><b>" +
telephone +"</b></p>";
GEvent.addListener(markerOnMap,
'click', function()
{ markerOnMap.openInfoWindowHtml(html);});
return markerOnMap;
}
function processMyData(data) {
var markersfoo = [];
var markerCluster;
var xml = GXml.parse(data);
var markersXml = xml.documentElement.getElementsByTagName
("marker");
for (var i = 0; i < markersXml.length; ++i) {
var title = markersXml[i].getAttribute("title");
var street_address = markersXml[i].getAttribute
("street_address");
var city = markersXml[i].getAttribute("city");
var state= markersXml[i].getAttribute("state");
var zip_code = markersXml[i].getAttribute("zip_code");
var telephone = markersXml[i].getAttribute
("telephone");
var user = markersXml[i].getAttribute("username");
//var address =
markers[i].getAttribute("address");
var point = new
GLatLng(parseFloat(markersXml[i].getAttribute
("lat")), parseFloat(markersXml[i].getAttribute("lng")));
var markerOnMap = createMarker(point, title,
street_address,
city, state, zip_code, telephone);
markersfoo.push(markerOnMap);
}
markerCluster = new MarkerClusterer(map, markersfoo);
GEvent.addDomListener(document.getElementById('colorado'),
'click', function() {
map.setCenter(new GLatLng( 39.9,-105.6), 7);
});
}
//]]>
On Nov 23, 5:05 pm, "[email protected]" <[email protected]>
wrote:
> On Nov 23, 1:53 pm, David <[email protected]> wrote:
>
>
>
> > Hi all,
>
> > I have been slowing learning my way around Google Maps and need some
> > help with a custom icon.
>
> > The site in question is located at:
> > http://www.internetpersona.com/map4/map5.html
>
> > I am using MarkerClusterer and have already changed the .png image for
> > the clustered addresses. I am having no luck understanding where to
> > make the change for the single marker. The google default marker
> > keeps popping up even after I've commented out the line that seems to
> > point to it.
>
> > Needless to say I am unable to substitute my own marker when I can't
> > even find out where the orginial is referenced. It may be in the
> > MarkerClusterer.js script. Unfortunately, I can't seem to find it
> > there either.
>
> > Any help would be very much appreciated.
>
> This line defines a GMarker with the default icon:
> var markerOnMap = new GMarker(point);
> to use your own icon you need to use the format:
> var markerOnMap = new GMarker(point, {icon: myIcon});
> (where myIcon refers to your icon.
> See:http://code.google.com/apis/maps/documentation/reference.html#GMarker
> and:http://code.google.com/apis/maps/documentation/reference.html#GMarker...
>
> -- Larry
--
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.