Hello,

I have tried to implement a combination of Martin's and geocodezip's
example code from:
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/7cf7cca29ed1892a

but it now prevents my regional_markers from displaying
at all. Please can you let me know what is wrong. This first section
relates to Geocodezip's code which checks the currentZoom, and
in my code compares it to the maxZoom:

// A function to create the marker and set up the event window
      function createMarker
(point,name,infotitle,html,icontype,maxZoom) {
        // === create a marker with the requested icon ===
        var marker = new GMarker(point, gicons[icontype]);
                        if(icontype == 'pushpin' || icontype ==
'arrow') {
                                GEvent.addListener(marker, "click",
function() {

                                  var currentZoom = map.getZoom();
                  //         alert("currentZoom="+currentZoom);
                  if (currentZoom < maxZoom) {
                      GMarker.hide();
                  }

                                  // map.setCenter(marker.getPoint
(),maxZoom,G_SATELLITE_MAP);
                                  map.setCenter(marker.getPoint
(),maxZoom);//no infowindow only
center on point,maxZoom and maptype
                                });
                        }else{
                        GEvent.addListener(marker, "click", function()
{
                                  marker.openInfoWindowHtml("!",
{buttons:{restore:{show:4}},
maxContent: html, maxTitle: infotitle, noCloseOnClick: true});
                                  window.setTimeout(function()
{map.getInfoWindow().maximize()},
200);
                        });
                        }

        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;
        // add a line to the side_bar html
        side_bar_html += '<a href="javascript:myclick(' + i + ')">' +
name + '</a><br>';
        i++;
        return marker;
      }

============================================
Secondly, this part of my code builds my regional markers - and here i
have tried to add Martin's code (i presumed i needed both bits of
code!):

var markers = xmlDoc.documentElement.getElementsByTagName
("regional_markers");
                 GEvent.addListener(map, 'zoomend', function(oldZoom,
newZoom){
                 for (var i = 0; i < markers.length; i++) {
                        // obtain the attribues of each marker
                       var lat = parseFloat(markers[i].getAttribute
("lat"));
                       var lng = parseFloat(markers[i].getAttribute
("lng"));
                       var point = new GLatLng(lat,lng);
                        var label = markers[i].getAttribute("name");
                        var minZoom = parseFloat(markers
[i].getAttribute( "minzl" ) );
                        var maxZoom = parseFloat(markers
[i].getAttribute( "maxzl" ) );
                        //GLog.write('name  ' + label + '  min  ' +
minZoom + '  max  ' +
maxZoom);
                        var reg_id = markers[i].getAttribute("id");
                        var nat_id = markers[i].getAttribute
("nat_id");
                        //GLog.write(title);
                        //GLog.write(photo);
                        // === read the icontype attribute ===
                        var icontype = markers[i].getAttribute
("icon");
                        //GLog.write(icontype);

                        if (markers[i].maxZoom>newZoom){
                                if (!markers[i].isHidden()){
                                        markers[i].hide();
                                } else if (markers[i].isHidden() &&
markers[i].maxZoom<=newZoom){
                                        markers[i].show();
                                }
                        }

            // === create the marker, passing the icontype string ===
            var marker = createMarker
(point,label,infotitle,html,icontype,maxZoom);      //
'infotitle,html,' - need to be present otherwise the regional icons
won't display -- very weird!
                        //map.addOverlay(marker);
                        markerManager.addMarker
(marker,minZoom,maxZoom);
             }
             }); // close addListener 'zoomend'

Any help or advice is much appreciated
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to