|
|
|
|
|
|
|
Example 6
Well, with the exception of the polygon tag (which is exactly the same as the polyline tag, except
it connects the last point to the first point to close the shape), we've used all the figure overlays, the markers,
the user controls and infowindows. Also notice that we completely removed the zoom
attribute in the <googlemaps:map> tag, letting the map autozoom itself to fit its contents. The autozooming
on version 1 maps gives us more control, accounting for the user controls (if present). The version 2 API does not give
us as much control, so the maps zoom the same, whether or not user controls are present.
There's not a lot more we can do at this stage of the game with just the tag library itself.
Here's the code we used (changes & additions are highlighted):
<googlemaps:map id="map" width="250" height="300" version="1" type="STREET" >
<googlemaps:key domain="localhost" key="xxxx"/>
<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:infowindow display="false">
74 Connor Lane<br/>Elkton, MD
</googlemaps:infowindow>
</googlemaps:marker>
<googlemaps:marker id="marker2" point="point2">
<googlemaps:infowindow display="false">
1226 Forest Parkway<br/>West Deptford, NJ
</googlemaps:infowindow>
<googlemaps:icon icon="/GoogleMaps/images/g.png"
shadow="/GoogleMaps/images/g_shadow.png"
anchorX="23" anchorY="48" iconWidth="48" iconHeight="48"
shadowWidth="64" shadowHeight="48"
infoWindowAnchorX="23" infoWindowAnchorY="1"/>
</googlemaps:marker>
<googlemaps:circle id="circle1" point="point1" radius="10" color="#ff0000"
weight="3"/>
<googlemaps:circle id="circle2" point="point2" radius="25" color="#ff0000"
weight="3"/>
<googlemaps:polyline id="line1" pointlist="point1, point2" color="#0000ff"
weight="5"/>
<googlemaps:box id="box1" pointlist="point1, point2" color="#00ff00"
weight="5"/>
<googlemaps:panControl enable="true"/>
<googlemaps:typeControl enable="true"/>
<googlemaps:zoomControl enable="true" size="large"/>
<googlemaps:wheelControl enable="true"/>
<googlemaps:scaleControl enable="true"/>
</googlemaps:map>
Okay, that gets most of the Google:map tags out of the way, now let's see how we can actually use this thing
in production.
This ends the basic examples for using the Google:map taglibrary. See the conclusion
or if you're feeling a little gamey you can proceed to the Advanced Examples
(where we discuss using events) or Miscellaneous examples (which mostly deal with ways
to dynamically add elements through JSTL and XML).
|
|
|
|
|
|
|
|
|
|
Google™ and the GoogleMaps API are copyright of Google.
|