|
Example 13 - Traffic Conditions
This map demonstrates the new Traffic Conditions capabilities of the Google Maps JSP Taglibrary.
The traffic tag allows you to specify a centerpoint and radius within which to scan for traffic events.
These events can be searched for by severity, or by type (construction or non-construction related).
The <googlemaps:traffic> tag also accepts <googlemaps:icon> tags as children allowing
you to specify custom marker icons.
Each traffic event that is found will generate a new marker on the map, with a clickable
info window which displays the specifics, like full description, severity and direction (if it's a
direction specific incident).
This map is not static so as traffic conditions change, so will this map. If you see no traffic
markers on this map, then it's a good day to live in Baltimore. Check back later, it's not always like
that...
Here's the code we used:
<googlemaps:map id="map" width="780" height="300" version="2" type="STREET" zoom="8">
<googlemaps:key domain="localhost" key="xxxxx"/>
<googlemaps:point id="point1" address="" city="Elkton" state="MD"
zipcode="21921" country="US"/>
<googlemaps:traffic id="traffic" point="point1" radius="20" severity="2"
type="incident">
<googlemaps:icon icon="/GoogleMaps/images/accident.png"
iconWidth="100" iconHeight="35"
anchorX="50" anchorY="35" infoWindowAnchorX="50" infoWindowAnchorY="1"/>
</googlemaps:traffic>
<googlemaps:traffic id="construction" point="point1" radius="20" severity="2"
type="construction">
<googlemaps:icon icon="/GoogleMaps/images/construction.png"
iconWidth="48" iconHeight="48"
anchorX="24" anchorY="48" infoWindowAnchorX="24" infoWindowAnchorY="1"/>
</googlemaps:traffic>
</googlemaps:map>
Our next example shows how to integrate the
Google Maps JSP Taglibrary with JSTL to create database driven maps.
Return to the Examples page.
|