News Examples Documentation Download Buy Forum Contact



XML Extensions


Third Party Software
for krpano

NOTE: This page is from an older version, see the latest version here.

Google Maps Plugin googlemaps.js Version 1.20.7

  • The Google Maps Plugin adds an interactive Google Map to the viewer.
  • The map can be freely placed and sized anywhere on the screen.
  • It's possible to place spots on the map and link them to krpano actions like loadpano to load a new panoramas when clicking a spot.
  • The plugin has an integrated customizable radar which can apear on the activatted spot.
  • And it's possible to control the whole maps and spots dynamically, e.g. pan/zoom around on the map, add or remove spots...
  • Google Maps / Bing Maps Notes - the XML interfaces of the Bing Maps and the Google Maps plugins are almost the same. Just replace the plugin files.

Plugin documentation topics:

Usage Syntax

The Google Maps Plugin embedding with all attributes / sub-nodes and their default values:
<plugin name="map" devices="html5"
        align="leftbottom" width="400" height="300" x="0" y="0"
        bgcolor="0x000000" bgalpha="0.0"
  <spotstyle name="style1" ... />
  <spot name="spot1" ... active="true" />
  <spot name="spot2" ... />
  <spot name="spot3" ... />
  <radar visible="true" ... />

Plugin Attributes

  • key
  • maptype
    • Select the type of the map:
      • satellite (default)
      • normal
      • hybrid
  • language
  • region
    • Select a custom region for the map.
    • More information
    • Note - The region setting need to be set already at startup of the plugin, changing it later is not possible!
  • lat / lng
  • zoom
    • Set zoom level of the map.
    • Can be from 1 to 25.
  • tilt
    • Set the tilt level of the map.
    • More information here.
    • Can be 0 (not-tilted) or 45, default=0.
  • heading
    • Set the heading of the tilted map.
    • Can be from 0 to 360, default=0.
  • controls
    • Select which default controls should appear on the map.
    • Available options (can be combined by a | character):
      • zoom - zoom control
      • maptype - map type selection control
      • scale - show map scale
      • streetview - street-view control
      • rotate - rotate control
  • poi
    • Show points of interest on the map.
    • True or false, default=false.
  • activespotenabled
    • Should the active spot be enabeld?
      That means - should the active spot react to click or over events.
    • True or false, default=false.
  • bgcolor / bgalpha
    • The color and alpha of the map background.
  • mapsapi
    • Set manually a different url of the Google Maps API.
    • The full url, including the protocol would need to be set.
    • When not set, the default url:
      • for HTTP or
      • for HTTPS
      will be used.
    • Usage example - when the default Google Maps urls are blocked, the alternative url could be used.
  • apiversion
    • Set manually the Google Maps API version.
    • More information here.
    • When not set, the latest default version will be used.
  • gmAPI
    • An object that provides access to the internal Google Maps API.
    • This object will be only accessible via Javascript.
    • This object will be first available after the onmapready event.
    • Object structure:
      • gmaps - the Google Maps API google.maps object
      • map - the Google Maps API Map object
      • dom - the dom element where the map is embedded

Plugin Attributes - Events

  • onmapready
    • Will be called when the Google Maps Plugin is loaded and ready for usage.
  • onmaptypechanged
    • Will be called when the map type was changed.
  • onmapmoved
    • Will be called when the map was moved.
  • onmapzoomed
    • Will be called when the map was zoomed.

Plugin Subnodes - <spotstyle>

  • With the <spotstyle> subnode it is possible to define styles for the spots.
  • A spot can be assigned to a spotstyle by the spotstyle attribute.
  • There is a predefined style named "DEFAULT".

The <spotstyle> node with all settings and their default values:
<spotstyle name="DEFAULT"

<spotstyle> Attributes

  • name
    • The name of the spotstyle.
      Use this name in the spotstyle attribute of a spot.
  • url
    • The url / path to an image that should be used for the spot.
      When not defined the default image (a blue dot) will be used.
  • overurl
    • The url / path to an image that will be used for the spot when it mouse is over the spot.
      When not defined the default image (a blue dot) will be used.
  • activeurl
    • The url / path to an image that will be used when the spot is activated.
      When not defined the default image (a green dot) will be used.
  • edge
    • The alignment edge / anchor point of the spot image.
      Possible values: lefttop, left, leftbottom, top, center, bottom, righttop, right, rightbottom.
  • x / y
    • The offset in pixels from the edge point to the image.
  • scale
    • Scaling for the spotstyle images.
    • Can be used to use higher resolution (2x scaled) images for the iPad 3 retina screen. Use the bigger image and scale="0.5" to get a 1:1 display of the image on the iPad 3.

Plugin Subnodes - <spot>

  • With the <spot> subnode it is possible to define spots on the map.
  • A spot will be placed at lat/lng coordinates and can be linked to panos by using the loadpano / loadscene actions in the onclick event.

The <spot> node with all settings and their default values:
<spot name="..."

<spot> Attributes

  • name
  • spotstyle
    • The name of the spotstyle that should be used for that spot.
  • url
    • The url / path to an image that should be used for the spot.
      When not defined the image from the spotstyle will be used.
  • lat / lng
  • heading
    • The heading of the pano in degrees, needed to align the pano orientation with the radar on the map.
    • See also the radar headingoffset setting for details.
  • active
    • State of the spot. When set to true the spot will be activated. That means the spot will show the active spotstyle image (when no url was set) and that the radar will be shown at the spot location.
    • To activate a spot dynamically use the activatespot() action.

<spot> Events

  • onover
    • Actions / functions that will be called when the mouse moves over the spot element.
    • Actions / functions that will be called in intervals (several times per second) when the mouse stays over / hovers the spot element.
    • Actions / functions that will be called when the mouse moves out of the spot element.
    • Actions / functions that will be called when there is a mouse click on the spot element.

<spot> Actions

Plugin Subnodes - <radar>

  • Add and style a radar.
  • The radar will be shown at the active spot position.

The <radar> node with all settings and their default values:
<radar visible="true"

<radar> Attributes

  • visible
    • Show or hide the radar.
  • dragable
    • Should the radar cone be dragable by the mouse?
  • size
    • The size / range of the radar cone.
  • zoomwithmap
    • Should the radar cone also be zoomed when zooming the map?
  • headingoffset
    • An offset for the heading value of the spots.
    • The default value for headingoffset is 90, which means heading=0 is pointing to right/east by default. Use headingoffset=0 to let heading=0 pointing to top/north.
  • alpha
    • The alpha transparency of the whole radar element.
  • fillcolor / fillalpha
    • The color and alpha of the filling of the radar cone.
  • linewidth / linecolor / linealpha
    • The linewidth, color and alpha of the line around the radar cone.
  • glow / glowcolor / glowwidth / glowstrength (Flash only)
    • Add and style the glowwing effect of the radar cone.

Plugin Actions

Actions of the Google Maps Plugin object.

Usage example:

Actions documenation: