GoogleMaps JSP Taglibrary  

Example 26 - Limiting Map Movement

Ever wish you could limit the customer's movement to only the area of the map that you've actually created content for? Well now it's as easy as one little attribute, the bound attribute.

If you set bound to true (bound="true") then users can only pan the map as far north, south, east or west as the furthest point that you've added to the map. Pretty cool, huh?

You can go ahead and try it. Our map only has the two points (with markers) on it. So you can't go too far...

Here's the code we used:

<googlemaps:map id="map" width="780" height="300" version="2" type="STREET"
	minZoom="5" maxZoom="10" bound="true">
  	<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:point id="point2" address="1226 Forest Parkway" city="West Deptford" 
  		state="NJ" zipcode="08066" country="US"/>
  	<googlemaps:marker id="marker1" point="point1"/>
	<googlemaps:marker id="marker2" point="point2"/>
  	<googlemaps:typeControl enable="true"/>
	<googlemaps:zoomControl enable="true" size="large"/>
  	<googlemaps:scaleControl enable="true"/>
  	<googlemaps:panControl enable="true"/>
  	<googlemaps:overviewControl height="200" width="200" x="605" y="279"/>
</googlemaps:map>  
  

Map movement limiting only works on version 2 maps.

Our next example demonstrates image inserts and how you can use them to display updated information on a GoogleMap.

Google
Search for Google Maps technology:

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