GoogleMaps JSP Taglibrary  

Example 28 - Displaying Coordinates

Are you writing a Google Maps application where the end user needs to know the longitude and latitude of where their cursor is pointing? Welcome to the <googlemaps:coordinates> tag.

This tag let's you display the current longitude and latitude of the cursor on your map, complete with style and class attributes.

Here's the code we used:

<googlemaps:map id="map" width="780" height="300" version="2" type="STREET">
  	<googlemaps:key domain="www.lamatek.com" key="xxxxx"/>
	<googlemaps:point id="point1" longitude="-75.86409330368042" 
		latitude="39.58490425759099"/>
	<googlemaps:point id="point2" longitude="-75.85079330368042" 
		latitude="39.58617425759099"/>
  	<googlemaps:typeControl enable="true"/>
	<googlemaps:zoomControl enable="true" size="large"/>
  	<googlemaps:scaleControl enable="true"/>
  	<googlemaps:panControl enable="true"/>
  	<googlemaps:insert id="insert1" point="point1" width="275" height="300" 
  		baseZoom="17" url="/GoogleMaps/images/insert_1.gif" mapTypes="Map"/>
  	<googlemaps:insert id="insert2" url="/GoogleMaps/images/insert_2.gif" 
  		point="point2" width="300" height="300" baseZoom="15" mapTypes="Map"/>
  	<googlemaps:coordinates x="250" y="275" 
  	    style="background: #ffffff; border: dashed 1px #000000; opacity: 0.50; 
  	    filter: alpha(opacity=50);"/>
</googlemaps:map>  
  

The coordinates tag requires version 2 maps.

Our next example shows how to display day & night zones on your map.

Google
Search for Google Maps technology:

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