Hi folks,

Im not a coder (bar a fortran class 35 yrs ago) but somehow I have
managed to put together my first google map, including this excellent
clustering lib.

Now I'm trying to add one last piece of functionality to the map:
change map type with zoom level .

I have added the appropriate code to a function that fires when the
map first loads and it works correctly, you can see the map here:

http://ioannina360.gr/gm_nt02.html?type=p&zoom=14 (loads terrain map
at zoom 14)

http://ioannina360.gr/gm_nt02.html?type=p&zoom=15 (should load terrain
map at zoom 15, but the code detects that zoom > 14 and changes the
map type to satellite)

feel free to play with it, type p is for terrain, type h is for
satellite


To add the same functionality to subsequent zoom level changes, I
tried to create an event listener with no luck, it doesn't work.

GEvent.addListener(map, "zoomend", chkZoom);

function chkZoom() {

  czoomlevel = map.getZoom();
  cmaptype = map.getCurrentMapType();

  if (czoomlevel > 14) {
     if (cmaptype == G_PHYSICAL_MAP) {
        map.setMapType(G_SATELLITE_MAP);
     }
  }

}

Since the same code works when the map first loads, I must be doing
something dumb with the event listener.

Any help you can provide to figure this out would be greatly
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 Google-Maps-API@googlegroups.com
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to