Home -> VRSmarty plugins page -> googlemap.swf
This plugin is completely free for use in any context or connection.
googlemap.swf
VRSmarty plugin for displaying a Google map with interactive markers that have mouse-over, mouse-out and mouse-click functions.

Selectable options are marker crosshair or variable radar cone and marker Infowindow at mouse-over.

Map markers can be arranged into groups that can be shown or hidden with a single command.

The following parameters are supported:

In VRSmarty xml file:
xmlfilexmlFile=googlemap.xmlplugin control XML file
setupModesetupMode=1mode for creating and positioning map markers


The following parameters can be set from VRSmarty:
xmlfilexmlFile=googlemapa.xmlload new XML file
mapWidthwidth=30%map width in pixels or percentage of pano width
mapHeightheight=250map height in pixels or percentage of pano height
mapSizesize=400:40%map size (width:height)
zoomLevelzoomLevel=12zoom level (0-19 (20 for SATELLITE) )
mapTypemapType=SATELLITEmap type (NORMAL, SATELLITE, HYBRID or PHYSICAL)
crosshaircrosshair=1crosshair on
crosshair=0crosshair off
crosshair=59.3095:18.0738crosshair position (see NOTES below)
radarradar=1radar on
radar=0radar off
radar=59.3095:18.0738radar position (see NOTES below)


The following functions can be called from VRSmarty:
panTo(lat:lon)panTo('59.3155:18.0700')pan to new map center
or
panTo(marker)panTo('The Royal Castle')pan to marker
click(marker)click('The Yatch Club')simulate clicking a marker
addMarker(data)addMarker('Small bridge: 59.308335:18.049968:75: global.goSmallBridge')add map marker (see below)
removeMarker(marker)removeMarker('Small bridge')remove map marker
clearMarkers()clearMarkers()clear all markers from map
showGroup(group)showGroup('food')show marker group(s)
hideGroup(group)hideGroup('pano:views')hide marker group(s)



In plugin external xml file, the following tags and attributes are supported:

In <map> tag:
keykey="ABQIAAAAu86lsW-dj3..."Google Maps API key (get this from http:code.google.com)
sizesize="400:40%"size of map
langlang=frlanguage code (default: language code is taken from browser settings)
mapTypemapType="NORMAL"set startup map type (see maptypes below)
mapCentermapCenter="59.3425:18.0900"set startup map center coordinates (WGS84 Lat and Long separated by ":")
zoomLevelzoomLevel="11"set startup map zoom level
In <controls> tag:
zoomzoom="mini"zoom control: 0, 1 or mini (default 0)
positionposition="1"positioning and panning control: 0 or 1 (default 0)
mapTypemapType="vertical"maptype selector: 0, 1 or vertical (default 0)
overViewoverView="left"overview map: 0, 1 or left (default 0)
In <maptypes> tag:
includeinclude="NORMAL,SATELLITE,HYBRID"comma separated list of maptypes to be included in the maptype selector
choose between NORMAL, SATELLITE, HYBRID and PHYSICAL (no default)
In <infowindowformat> tag:
widthwidth="120"width of infowindow
borderColorborderColor="#CFCFCF"infowindow border color
bgColorbgColor="#223344"infowindow background color
fontfont="Arial"infowindow text font
textColortextColor="#FFFFF0"infowindow text color
textSizetextSize="11"infowindow text size
boldbold="1"infowindow text bold
italicitalic="0"infowindow text italic
underlineunderline="0"infowindow text underlined
In <icons> tag:
removeoldremoveold="0"0 or 1 (default 1) delete old icons when loading new XML file
In <icon> child tag:
namename="red"icon name
urlurl="img/pin2s_red.png"icon image file (if not specified - a Google standard icon is used)
alignalign="BL"icon alignment: L=left, C=center, R=right, T=top, M=middle, B=bottom
default: CM (Center-Middle)
shadowshadow="1"tells the Google map to apply a shadow to the icon
defaultdefault="1"will make this the default marker icon
defaultVisiteddefaultVisited="1"will make this the default visited marker icon
markerColormarkerColor="#C0C0FF"icon color - for Google standard icons
markerRadiusmarkerRadius="6"icon radius - for Google standard icons
In <markers> tag:
removeoldremoveold="0"0 or 1 (default 1) delete old markers when loading new XML file
In <markers><marker> tag:
namename="City Hall tower"marker name - also used as tooltip
typetype="noradar"marker type, "pano", "noradar" or "simple", see NOTES below
groupgroup="pano:view"marker group, see NOTES below
hiddenhidden="1"set to 1 if you want this marker to be initially hidden
coordscoords="59.327331:18.055925"marker coordinates (WGS84 Lat and Long separated by ":")
iconicon="red"name of icon to be used for marker
if not specified - default will be used
iconVisitediconVisited="green"name of icon to be used for visited marker
if not specified - default will be used
offsetoffset="48"pano compass offset - "48" means pano 0 = 48 degrees compass direction
commanddeprecated - use onClick instead
onClickonClick="global.gotower()"VRSmarty command(s) executed when marker is clicked
onOveronOver="global.showP1()"VRSmarty command(s) executed when the mouse is moved over the marker
onOutonOut="global.hideP1()"VRSmarty command(s) executed when the mouse is leaving the marker
In <markers><marker><infowindow> tag:
Contains HTML for the marker infowindow (see below)
<infowindow><![CDATA[<body>The Yacht Club<br/><img src="../img/yachtclub.jpg" hspace="0" vspace="3" width="100" height="67" /></body>]]></infowindow>
In <radar> tag:
urlurl="img/mapradar11.png"radar image file
visiblevisible="1"use radar at current marker: 0 or 1, default 0
lengthlength="40"radar cone length, default=30
lineWidthlineWidth="1"radar cone line width, default=0 (hairline)
lineColorlineColor="#FFFFFF"radar cone line color, default=#000000
fillColorfillColor="#FFFFFF"radar cone fill color, default=same as line color
fillAlphafillAlpha="0.25"radar cone fill alpha, default=0.30
In <crosshair> tag:
urlurl="img/crosshair12.png"crosshair image file
visiblevisible="1"use crosshair at current marker: 0 or 1, default 0
In <onstart><command> tag:
  param_name=valueplugin commands (NOT VRSmarty commands) that you want to
execute after the map has been initialized. There is
no limit to the number of commands.
<onstart>
<command>panTo=City Hall tower</command>
</onstart>


NOTES:

All tag names must be written in lower case, but attribute names are case independent (panTo is equal to panto).

If omitted, language code is taken from browser settings. NOTE: Google generally advise against specifying this parameter (unless, of course, you want to force using a certain language). For a listing of language codes, see your browser settings.

Specify one <icon> tag for every DIFFERENT marker image that you want to use. Then you can refer to the proper icon name in the <marker> tag. So if you have ten markers on the map that all look the same, you only have to use one <icon> tag. If you don't specify the icon="..." attribute in the <marker> tag, then you will get the default marker icon. And if you don't specify the iconVisited="..." attribute then you will get the default visited marker icon when the marker is panTo'ed.

Marker type can be set to "pano", "noradar" or "simple". Default is "pano", which when clicked will be centered in the map, and the radar - if used - will be placed at the marker. If type is set to "noradar", the marker will be centered in the map, but the radar will remain at its present position. Finally, when a "simple" marker is clicked, there will be no change in the map - only the onClick command will be executed. "noradar" and "simple" are thought to be used for map POI's other than panos - like pictures, videos or other links.

Certain characters cannot be used directly in an XML file without having to be encoded. Ususally, web encodings (like ' for ' single quote) are used as the data is usually targeted for an HTML page. But here you have to use escape-coding (also called url-encoding) at least for:

" as %22
& as %26 (seems to work as is, but I recommend encoding)

When loading a new XML file with the xmlFile command, only the following tags will be parsed:
  <icons>
  <markers>
  <onstart>

All the other tags will be ignored.

The panTo command is useful when you have changed pano in some other way than by clicking on a map marker. It will center the map on a new position, and the radar (if used) will follow the panTo command - but only if you use panTo=marker_name. This is because the radar needs to know the offset value, which is a marker attribute. If you use panTo=lat:long only the map center will be changed. And if the new destination is too far away from the present point, the map will not pan, but make an immediate jump to the new center point. This is of course depending on the zoom level. The plugin keeps track of which marker is active, so if the same marker is clicked twice in a row, it will only execute the marker command(s) the first time. The panTo command makes the map center on a new position, and the radar follows the panTo command - but only if you use panTo=marker_name. This is because the radar needs to know the offset value, which is a marker attribute. If you use panTo=lat:long only the map center will be changed. And if the new destination is too far away from the present point, the map will not pan, but make an immediate jump to the new center point. This is of course depending on the zoom level. The plugin keeps track of which marker is active, so if the same marker is clicked twice in a row, it will only execute the marker command(s) the first time.

The showGroup and hideGroup commands can used to show or hide groups of markers. If you want to change more than one group, you can specify a colon separated list, for example: "showGroup=view:eat". To show or hide all markers use "all".

The click command is added to simulate a click on a marker from VRSmarty, and can be particularly useful when loading a new XML file. The difference from the "panTo" command is that the "click" command will execute the command associated with the marker.

Any number of onStart commands can be given. The syntax is the same as the usual parameter settings. Allowed parameters are those that can be updated dynamically (see the list above). The reason for having the onStart commands is that certain parameters (like panTo) cannot execute before the map has been initialized.

The crosshair can be turned on/off dynamically and moved by setting new coordinates i.e. "crosshair=59.3727:18.0170". The crosshair also always follows the panTo command.

What is said about the crosshair above, is also valid for radar. Don't forget to set the offset attribute in the <marker> tag to synchronize radar direction with the pano pan angle.

When using the addMarker command you have to include five colon-separated parameters:
   external.googlemap.addMarker=name:latitude:longitude:compass_offset:onClick_command
All five parameters must be included.
There is no automatic panning to the new marker when it is added.


Infowindow : For markers which have the <infowindow> childtag specified, an information window (often called callout) will appear above the marker at mouse-over. The content of this callout is described by the Adobe HTML subset, and must be written inside a <body> ... </body> tag if you want the attributes of the <infowindowformat> tag to be applied. The data in the <infowindow> tag must also be surrounded by <![CDATA[ ... ]]>, otherwise you will get an XML parsing error. The tooltip window with the marker name will not be shown for markers with a callout.


Setup mode:
Including the parameter "setupMode=1" forces the plugin to enter a setup mode for handling map markers. The following functions are supported:

Create marker:click map where you want the marker placed
Move marker:drag marker to new position
Select marker:click marker
Delete marker:click marker while pressing the Alt key
Setting marker tooltip:change tooltip text in textbox
Setting marker offset:change offset value in textbox
You have to enter the other marker attributes afterwards - this is only a help for setting the proper coordinates. NOTE! The plugin does not modify the XML file, you have to copy the <marker> tags that are generated in the textbox yourself to get them into the XML file. Markers you already have in your XML file can of course also be moved (and deleted).

Don't forget to remove the "setupMode=1" line afterwards!



Example plugin xml file:

<?xml version = '1.0'?>
<map
   key="ABQIAAAAu86lsW-dj3QJD95U-nm9CBS2At2q8T81EmvhoOPXhKXvyuASVhTbOTGJMFZQmoqDqf6YdNkPl2Tlyw"
   size="400:60%"
   mapType="SATELLITE"
   mapCenter="59.3425:18.0900"
   zoomLevel="11"
>
   
   <controls zoom="mini" position="1" mapType="vertical" overView="left" />
   <maptypes include="NORMAL,SATELLITE,HYBRID" />
   <infowindowformat width="130" borderColor="#CFCFCF" bgColor="#223344" font="Arial" textColor="#FFFFF0" textSize="11" bold="0" italic="0" underline="0" />

   <icons removeOld="1">
      <icon name="blue" url="img/dotblue3.png" align="CM" shadow="1" default="1" />
      <icon name="green" url="img/dotgreen3.png" align="CM" shadow="1" defaultVisited="1" />
      <icon name="bstar" url="img/starblue.png" align="CM" shadow="1" />
      <icon name="gstar" url="img/stargreen.png" align="CM" shadow="1" />
      <icon name="google" markerColor="#C0C0FF" markerRadius="6" />
   </icons>

   <markers removeOld="1">
      <marker name="City Hall tower" coords="59.327281:18.055522" offset="70" command="goTower()" >
         <infowindow><![CDATA[<body><p align="center">City Hall tower<br /><img src="/panos/images/thumbs/cityhall.jpg" hspace="0" vspace="3" width="100" height="67" /></p></body>]]></infowindow>
      </marker>
      <marker name="The Yacht Club" coords="59.303949:18.073166" offset="10" command="goYachts()" >
         <infowindow><![CDATA[<body><p align="center">The Yacht Club<br /><img src="/panos/images/thumbs/yachtclub.jpg" hspace="5" vspace="3" width="100" height="67" /></p></body>]]></infowindow>
      </marker>
      <marker name="The train bridge" coords="59.310240:18.042809" offset="-15" onClick="goBridge()" >
         <infowindow><![CDATA[<body><p align="center">The train bridge<br /><img src="/panos/images/thumbs/pano3.jpg" hspace="0" vspace="3" width="100" height="67" /></p></body>]]></infowindow>
      </marker>
      <marker name="I work here" coords="59.3727:18.0170" offset="-100" command="goWork()" >
         <infowindow><![CDATA[<body><p align="center">I work here<br /><img src="/panos/images/thumbs/work.jpg" hspace="0" vspace="3" width="100" height="67" /></p></body>]]></infowindow>
      </marker>
      <marker name="I live here" coords="59.3095:18.0738" icon="bstar" iconVisited="gstar" command="goHome" >
         <infowindow><![CDATA[<body><p align="center">I live here<br /><img src="/panos/images/thumbs/home.jpg" hspace="0" vspace="3" width="100" height="67" /></p></body>]]></infowindow>
      </marker>
   </markers>

   <radar visible="1" length="40" lineWidth="1" lineColor="#FFFFFF" fillColor="#A0A0FF" fillAlpha="0.30" />

   <onstart>
      <command>gmap.content.panTo(City Hall tower)</command>
   </onstart>
</map>
					


Version history:

1.1:
width/height set function overridden