| |||||||
| FRAMES NO FRAMES | |||||||
<%@ taglib prefix="googlemaps" uri="/WEB-INF/googlemaps.tld" %>
<anyxmlelement xmlns:googlemaps="urn:jsptld:/WEB-INF/googlemaps.tld" />
A custom tag library to provide general GoogleMaps API capabilities.
Google recently released it's wonderful
GoogleMaps API to the
public. GoogleMaps API is a javascript/AJAX application that provides dynamic,
interactive mapping and satellite capabilities for webpages. The possible uses are
endless.Before using GoogleMaps and the GoogleMaps API JSP Tag Library you should read their
Terms of Use and you will need to Register
each domain that will use the API.While this tag library does not expose all the possibilities of the GoogleMaps API,
it provides good functionality without the need to learn the API, advanced Javascript or
AJAX, and provides a familiar JSP tag library interface.What this tag library provides that GoogleMaps API does not provide is some
geolocation capabilities. Geolocation is the practice of converting a physical location
to a longitude/latitude pair. The GoogleMaps API JSP Tag Library allows you to specify a location
by any of the following, not just Longitude and Latitude pairs:
It also provides built-in capabilities to draw circles, boxes and polygons that the standard API does not contain.
The GoogleMaps API JSP Tag Library also provides mousewheel handling that the default
GoogleMaps API does not.
The tags fit into 2 categories: 1) Data tags that provide the data needed to create a map and 2) Display tags that generate the actual HTML, Javascript and AJAX output.
The following tags make up the data portion of the tag library:
The following tags represent the display portion of the tag library. They must be placed after the <googlemaps:map> tag and have specific places they must be put:
Future versions of this tag library will provide driving directions, course plotting and much more.
Stay tuned!
| Tag Library Information | |
| Display Name | GoogleMaps JSP Tag Library |
| Version | 1.0 |
| Short Name | googlemaps |
| URI | /WEB-INF/googlemaps.tld |
| Tag Summary | |
| map | This tag provides the general setup for a GoogleMap. It provides Geolocation functionality and initialization features, but generates no output. The following tags are children of the <googlemaps:map> tag: |
| coordinates | This tag adds a small control to the map that displays the cursor's current longitude and latitude location. Developers can assign style and class attributes, as well as an x and y anchor point. |
| insert | The insert tag allows you to add an image as an overlay directly on the map. When the map is moved, the image moves. When the map is zoomed, the image zooms. It provides a simple way to provide an overlay onto a map without having to create your own tiles. |
| label | Allows developers to place a label (rather than a marker) on a map. This could be used to label interesting areas, etc. Labels do not accept events, and do not block events. Only works on version 2 maps. |
| cluster | Clusters multiple markers into single larger markers, based on the attributes set. This provides cleaner maps at smaller zoom levels and improves the performance of the map. As the user zooms in, the clustered markers will expand to reveal all the markers in it's cluster. You can define a single <googelmaps:icon> tag as a child to this tag to define the clustered icon (so users can differentiate them from non-clustered icons). |
| overviewControl | Displays a smaller overview control map of the specified width and height, at the specified x, y location. Only works with maps of version 2.41 or higher. Maps of earlier versions will be ignored. |
| wms | No Description |
| maptype | Allows developers to define custom maps through a custom tile provider. The developer provides a url to a resource that can return map tiles based on x tile number, y tile number and zoom level. |
| icon | Allows you to specify a custom icon and matching shadow for markers. This tag must be the child of a <googlemaps:marker> tag to work. Note that the images should be .png files, 24 bits. The shadow and the icon images must line up properly from the upper left hand corner. |
| imageoverlay | Allows the user to define a fixed image overlay. This can take the form of a button, a logo, whatever. The image can also be assigned a hyperlink that will be triggered if clicked on. |
| traffic | This tag displays a series of markers that relate to traffic events within a defined radius of a given point. The severity of the events can be selected, and when a traffic event marker is clicked, the details of the event are displayed in an info window. A <googlemaps:traffic> tag can be parent to a <googlemaps:icon> tag to specify unique icons for traffic events. |
| event | Adds an event listener to the parent tag. This tag can only effectively be a child of a <googlemaps:map> or <googlemaps:marker> tag. If a child of any other tag, this tag will register itself with the next highest instance of <googlemaps:map> or <googlemaps:marker>. When a map or marker with a registered event is triggered, the URL is called additional parameters based upon the parent component type and the event that is triggered. The complete list is as follows:
The intended use is to have the event trigger a request to either a servlet or JSP page. This page would retrieve the map from the session using the map id (passed as map parameter) making the required changes, additions, etc. and then pass the response back to the requesting page or another page that displays that map, which would then render the map with the changes. For this methodology to work properly, the parent map must have a scope of type site, so the receiving entity can locate the map from the session. |
| key | The <googlemaps:key> tag allows you to specify multiple keys for your GoogleMaps API. To use this tag library you will need to register each domain that will use the API. If your website is registered with multiple domain names, you will need to obtain and specify a key for each one |
| body | Allows you to specify body content for the GoogleMap generated <div> tag. This is reserved for future use (potentially in generating custom controls). |
| message | Allows you to specify a message window to appear when maps are loading or requests are being processed. |
| marker | Adds a marker to the google map. A <googlemaps:map> tag can have any number of marker tags. The marker may contain child <googlemaps:infowindow> tags. |
| infowindow | Describes an <googlemaps:infowindow> for a <googlemaps:marker>. There can only be one <googlemaps:infowindow> tag per <googlemaps:marker> tag. If set to display, the <googlemaps:infowindow> will be initially displayed, otherwise it will be displayed when the user clicks on the corresponding marker. If an <googlemaps:infowindow> is going to display HTML content, you must set the html attribute to true, otherwise the content will be rendered as XML and may give undesireable results. The body content of the <googlemaps:infowindow> tag will be the displayed data. You can include complete HTML pages including nifty things like forms, images and more! |
| tabbedInfoWindow | Displays a tabbed info window over the parent marker. The tabs are defined using <googlemaps:tab> tags as the body of this tag. |
| tab | Adds a tab to the parent <googlemaps:tabbedInfoWindow>. The body contents of this tab tag become the contents displayed in the tab. |
| blowup | Sets up a map blowup window for the parent marker. |
| box | Draws a box on a GoogleMap using polylines. The pointlist must contain two points (additional points will be ignored) that will serve as the opposing corners of the box. Due to a problem in Internet Explorer, it is imperative that you use the following HTML tag in any page that uses the GoogleMaps API and Polylines in Internet Explorer: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> |
| polygon | Draws a closed polygon on a GoogleMap using polylines. It will plot a line between each of the points specified in the point list, and then close it back to the first point. Due to a problem in Internet Explorer, it is imperative that you use the following HTML tag in any page that uses the GoogleMaps API and Polylines in Internet Explorer: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> |
| circle | Draws a circle on a GoogleMap using Polylines using the location if the specified <googlemaps:point> as it's centerpoint. Due to a problem in Internet Explorer, it is imperative that you use the following HTML tag in any page that uses the GoogleMaps API and Polylines in Internet Explorer: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> |
| polyline | Allows the user to draw a polygonal line onto the Google Map. The <googlemaps:polyline> tag defines the generic attributes for the line (color, size, etc.). The <googlemaps:points> ids listed in the pointlist form the endpoints of each line segment. Due to a problem in Internet Explorer, it is imperative that you use the following HTML tag in any page that uses the GoogleMaps API and Polylines in Internet Explorer: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> |
| point | A point represents a geographical location. User must specify either a longitude/latitude pair or address information. This tag provides geocoding through the following:
|
| wheelControl | This tag, when present within a <googlemaps:map> tag set, will provide AJAX mousewheel support for smooth zooming in and out of your google map. This feature currently only works if the map version attribute is set to 1. Version 2 of the GoogleMaps API has significant exposure changes. Future versions should support this feature. |
| typeControl | This tag must be nested inside a <googlemaps:map> tag. It provides information on whether to allow the user to change map types. If added to a <googlemaps:map> tag and set to display, the user will be presented with three buttons in the upper right-hand corner of the map, allowing them to change the view to MAP, SATELLITE or HYBRID views on the fly. |
| zoomControl | This tag must be nested inside a <googlemaps:map> tag. It provides information on whether to allow the user to zoom in and out of the map. If added to a <googlemaps:map> tag and set to display it will provide the user with zoom in ('+') and zoom out ('-') buttons. If the size is set to large they will also get a full zoom slider control on the left hand side of the map. |
| panControl | This tag must be nested inside a <googlemaps:map> tag. It provides information on whether to allow the user to pan around the map. If added to a <googlemaps:map> tag and set to display, the user will be presented with up, down, left and right buttons in the uppor left-hand corner of the map. |
| scaleControl | This tag, when present within a <googlemaps:map> tag set, will display a map scale appropriate for the current zoom level. |
| scripttag | Generates the required script tag to import the GoogleMaps API. This tag must be placed after and outside the <googlemaps:map> tag and should be placed in the <head> section of your JSP for maximum portability. |
| javascript | Generates the required javascript AJAX code needed to create the google map. This must be placed after and outside the <googlemaps:map> tag. For maximum browser compatibility it should also be placed in the <head> section, anywhere after the <googlemaps:scripttag>. |
| div | Generates the <div> tag that will be the actual visible map. This tag must be placed after and outside the <head> tag. It can be placed anywhere on the page. |
| initialize | Generates the required javascript code to initialize the google map and register any listeners. For maximum browser compatibility, this tag should be placed just before the closing </body> tag. |
| |||||||
| FRAMES NO FRAMES | |||||||