GoogleMapsPlugin is a plugin for embedding Google Maps into a JSPWiki page. 

You can use it to mark certain landmarks, or to describe routes. Here's an example of how a running route was described with this plugin for a local event called [Parkfestlauf-Gemmingen|http://www.stz-bits.de/parkfestlauf-gemmingen/Wiki.jsp?page=Route]

The Plugin is Open Source (LGPL) -> [Download Sourcecode|http://www.i3g.hs-heilbronn.de/attach/GoogleMapsPluginProjekt/googlemaps-src.zip]


#Download the [GoogleMaps.zip|
http://www.i3g.hs-heilbronn.de/attach/GoogleMapsPluginProjekt/googlemaps.zip] and unzip it into your JSPWiki's WEB-INF directory.
#Edit WEB-INF/jspwiki.properties file and add org.wikiwizard.jspwiki.googlemaps to the property jspwiki.plugin.searchPath.
#Obtain an API key from [Google Maps|http://www.google.com/apis/maps/]. Your Web URL will depend on your configuration. Usually, it should be your jspwiki.baseURL property value.
#Edit WEB-INF/jspwiki.properties file add the key to the property jspwiki.Google.maps.key.
#Optional: Edit WEB-INF/googlemaps/googlemaps.properties if you want to modify or add marker and line styles
#Optional: Edit your template's CSS file and define a map id such as

#map {
    min-width: 400px;
    min-height: 400px;


Place the following line anywhere in a JSPWiki page.

[{GoogleMaps lat='coordinate latitude' lng='coordinate longitude'}]

Due to the nature of Google Maps, only one map is permitted per page.


;key:Google Maps API key, now deprecated and the value is loaded from properties file
;lat:Coordinate Latitude value from -90 to 90, must be enclosed in single quotation marks
;lng:Coordinate Longitude value from -180 to 180, must be enclosed in single quotation marks
;zoom:Zoom value from 0 to 19, where 0 is widest and 19 is closest
;type:hybrid, map or sat
;control:small or big
;width:plugin width
;height:plugin heigth
;trace: values true/false - adds a trace bar at the end of the plugin to display the current lat and lng -> useful for setting new markers
;fixIE:yes or no (workaround for InternetExplorer)

!Defining Markers and Lines between Markers

This is an example of two markers (points) with text in it and lines between those markers.

Heres an example of how the above image was created:
[{GoogleMaps lat='49.12271669366686' 

Marker p1: 49.12271669366686, 9.206113815307617
Das [i3g Institut|http://www.i3g.hs-heilbronn.de]

Marker p2: 49.12226732260275, 9.211091995239258
Die [Hochschule|http://www.hs-heilbronn.de]

p1 -> p2

To get the coordinate, you can use Google Maps to navigate to the point you want to display, double click it so it is centered, and make note of the ll=xx.xxxx,yy.yyyy value in "Link to this page" link. They are the latitude and longitude values respectively. 

Alternatively you can set the trace parameter to 'true'. This will display lat and lng at the bottom of the plugin in a yellow bar.

!!!Additional usage

!!Invisible Marker
Invis Marker: 49.12226732260275, 9.211091995239258

!!Marker (default color: red)
Marker: 49.12226732260275, 9.211091995239258

!!Colored Marker
Blue Marker: 49.12226732260275, 9.211091995239258

!!Marker with the name "m1" (helpful to create lines)
Marker point: 49.12226732260275, 9.211091995239258

!!Green Marker with the name "m2"
Green Marker m1: 49.17226732260275, 9.211091995239258

!!Marker with two Tabs
Marker: 49.12226732260275, 9.211091995239258

Tab: Tabname

Tab: Tabname2

49.12226732260275, 9.211091995239258 -> 49.15226732260295, 9.211091995239228

!!Colored Line
Red Lines:
49.12226732260275, 9.211091995239258 -> 49.15226732260295, 9.211091995239228

!!Line using Marker names
m1 -> m2 -> 49.15226732260295, 9.211091995239228

!!!Known Issues

!Map is not displayed (Internet Explorer)

Somehow the plugin does not work with Internet Explorer. But there is a workaround:

#Add fixIE='yes' to the plugin parameters.
# Change the ~ViewTemplate.jsp of the used JSPWiki template as follows:

  <script type="text/javascript">
  function checkgooglemaps(){
  	if ( window.googlemaps )

into the <head> section of the page. Then add an onload parameter to the <body> tag:

<body class="view" bgcolor="#FFFFFF" onload="checkgooglemaps()">

This should solve the problem. If anyone knows a better solution, please let us know (just add a comment below). It seems IE has a problem with directly executing the javascript code. But it works when putting all code into a function and executing it from onload. 

!Map is not displayed (Internet Explorer) %%(color:red)part 2/%:
The above solution prevents (?) the __window.onload__ call in commonheaders.jsp (breaking ~TabbedSection, ~SearchBox, Sortable, ~ZebraTable... etc.). The following solution works for me (2007-Jan-12, ~RonAtkins):

# Follow the directions in the section __Lines and overview map are not displayed__ (below, to resolve lines not being displayed in IE).
# Add fixIE='yes' to the plugin parameters.
# Make the following changes in __commonheader.jsp__ (of the JSPWiki template you are using):

{{{<%-- Here we define the "run when the page loads" -script. --%>
<script type="text/javascript">

function checkgooglemaps()
  	if ( window.googlemaps )

function runOnLoad()
  <wiki:IncludeResources type="jsfunction"/>

window.onload = runOnLoad;


!Lines and overview map are not displayed (Internet Explorer)

Even using the workaround for the IE problem, lines and the minmap are not displayed when using IE. The solution is described on the Google Maps API page: [http://www.google.com/apis/maps/documentation/#XHTML_and_VML]. The changes also have to be made in the ~ViewTemplate.jsp file.

This Plugin was implemented independently by the i3G Institute and msb0b.com.

The Plugin as described above is a [semester work|http://www.i3g.hs-heilbronn.de/Wiki.jsp?page=ImStudium] by Amir Farokhzad done at the i3G Institute.

The plugin by msb0b.com was published on this page three days before Amir Farokhzads Plugin, but the msb0b.com implementation is very basic an therefore is lacking several features

*User-defined map type
*Point information
*Multiple points
*Connect the points with lines

The msb0b.com Implementation is attached on this page. -> [GoogleMapsPlugin.java] and [GoogleMapsPlugin.jar].

Please visit the [project page of msb0b.com|http://msb0b.com/home/GoogleMapsPlugin] for more details.

14-Jun-2006 --[ChristophSauer]



--Fan Wang, 15-Jul-2006


I followed your guide step by step,

 Plugin insertion failed: Plugin failed 


My wiki is 2.4.53

--AnonymousCoward, 24-Sep-2006

The plugins seems to need Java 5... Also there is a little typo error which makes pop-up ballons go werk (javascript errors pop up). Specifically, in GoogleMaps.java, line 289 should look like this:

{{{map += "  document.getElementById(\"zoom\").innerHTML = map.getZoom()\n";}}}

also, as you fix this in the source code, ballons appear without content. In tomcat's stdout you can see that data is correctly retrieved but it's not shown in the G'Map

-- JP 02/10/2006

Update: I've been looking through the code. Wiki2HTMLConverter was using TranslatorReader which is deprecated since 2.3 so, when parsing text into Tabs you always got a blank String. Fixed the code for 2.4.x (thanks Janne for pointing [here|http://blog.jspwiki.org/wiki/Main_blogentry_151105_1] for instructions on how to parse wiki markup in 2.4). I've also corrected the small typo noted yesterday and removed all System.out's, as debugging with Eclipse is a lot easier if you want to follow the code. 

This jar has been tested on 2.4.64, compiled and uploaded to this page with the source code. Download the plugin for 2.4 branch clicking [here|googlemaps-plugin-2.4.64.zip]. The zip has the source code and the compiled jar (it's in the ./bin folder). For installing it, take that jar and follow the previous instructions (place it in WEB-INF/lib, etc)

-- JP 03/10/2006

I wanted to use this on a machine that only had Java 1.4 on it, so has to replace some Java 5 functions that were being used with some 1.4 equivalents. 

* String.replace(String regex, String text) became String.replaceAll(String regex, String text)
* String.contains(String needle) became String.indexOf(String needle)>=0

This [patch|java1.4_patch_for_googlemaps-plugin-2.4.64] is against the [2.4.64|googlemaps-plugin-2.4.64.zip] branch below.

To apply the patch and recompile.
unzip googlemaps-plugin-2.4.64.zip
cd googlemaps
patch -p1 < path/to/java1.4_patch_for_googlemaps-plugin-2.4.64
rm -Rf bin/org/
javac -d bin -classpath /path/to/apache-tomcat/common/lib/servlet-api.jar:/path/to/apache-tomcat/webapps/JSPWiki/WEB-INF/lib/JSPWiki.jar src/org/wikiwizard/jspwiki/googlemaps/*.java
cd bin/
rm googlemaps.jar 
zip googlemaps.jar -r .

then install the jar as normal (place it in WEB-INF/lib, etc)

-- Jonathan 2006/12/03

I followed the install step by step. But I got the following problem.

Plugin insertion failed: Could not find plugin GoogleMaps

I modify jspwiki.propertires file as the following:
jspwiki.plugin.searchPath =org.wikiwizard.jspwiki.googlemaps
                        ^^^^^^Google Maps key number

Does any get the same proble?
-- TonyChou     2009/03/17