if(carparks.getMap()) {
//Layer showing
}
Chad Killingsworth
On Jun 21, 5:19 am, PaulG <[email protected]> wrote:
> Hi,
>
> It is pretty simple code which I just got this working, and wondered
> if it really is the most efficient way of hiding a kml layer when the
> user zooms out too far. I was expecting to see a setting in the kml
> layer which would handle this kind of thing.
>
> Given that:
> map is my google mapv3 instance
> carparks is a kml layer
>
> google.maps.event.addListener(map, 'zoom_changed', function()
> {
> z = map.getZoom() ;
> if( z < 15 ){
> carparks.setMap(null)
> }else{
> carparks.setMap(map)
> }
> console.log('zoom has changed to ' + z );
> });
>
> Its just that if a user stays on the map and pans and zooms around
> staying at zoom levels 15-18 this piece of code is constantly re-
> assessing the zoom level and calling setMap again.
>
> Is there no other way? [Thinks] can I detect if the layer is already
> showing?
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.