Map Layers

This page demonstrates how to add a Layer to the map. Google Maps provides three layers: Traffic, Transit, and Bicycling.

On change of the select list item, the following JavaScript is run: // remove the previous layer, if it exists if (typeof lyr==='object') { lyr.setMap(null); } delete lyr; // get the layer switch ($v("P18_LAYER")) { case 'traffic': lyr = new google.maps.TrafficLayer(); break; case 'transit': lyr = new google.maps.TransitLayer(); break; case 'bicycling': lyr = new google.maps.BicyclingLayer(); break; } // put the layer on the map lyr.setMap( $("#map_mymap").reportmap("instance").map );