GoogleMaps JSP Taglibrary  

Example 8 - Map Maptypechanged

This map hears maptypechanged events. Maptypechanged events are triggered after users change the map type by clicking on the Map, Satellite or Hybrid buttons. If you click any of the map type buttons, you'll see the resulting event:

http://www.lamatek.com/GoogleMaps/example_8.jsp?event=maptypechanged&map=map1&type=xx

These parameters are provided:

  • map
    The id of the map that generated the event.
  • event
    The event type that was triggered (this example is maptypechanged)
  • type
    The desired map type (map, hybrid or satellite).
You may also notice that because we've reloaded the page and not processed the event the map is still showing the original map type (map). We'll discuss this more later.

Here's the code we used:

  <googlemaps:map id="map1" width="250" height="300" version="2" 
  			type="STREET" zoom="12">
	  <googlemaps:key domain="www.lamatek.com" key="xxxxx"/>
	  <googlemaps:point id="point1" address="74 Connors Lane" 
	  		city="Elkton" state="MD" zipcode="21921" country="US"/>
	  <googlemaps:event action="maptypechanged" url="/GoogleMaps/example_8d.jsp"/>
	  <googlemaps:typeControl enable="true"/>
	  <googlemaps:message>
		<img src="/GoogleMaps/images/loading.gif"/> Please wait...
	</googlemaps:message>
  </googlemaps:map>
  

Our next example examines processing these events and making the necessary map updates.

Google
Search for Google Maps technology:

Java JSP PHP ASP
Google™ and the GoogleMaps API are copyright of Google.