Streetview Mapsicle

A library to put overlays - images, text or HTML content - on top of a panorama in Street View. They can follow a location (given by lat/lng) or be at a fixed position on screen (coming soon). For now, Mapsicle doesn't work in full-screen mode. To register callbacks for events, use the GEvent interface and register for events on the Mapsicle object that you create.

For a description and examples of how to use this library, check out the how-to.

class Mapsicle

Constructor

Constructor Description
Mapsicle(container:Element, glatlng:GLatLng, custom:MapsicleParams) Creates a new Street View Mapsicle: a street view panorama which you can overlay with markers.

Methods

Methods Return Value Description
addLocation(newLocation:SVLocation) None Add a new location
clearLocations() None Remove all locations
close() None Close down this instance of Mapsicle
followLink(yaw:number) None Follow a link from the current position. This will fire the initialized event. This works exactly the same as GStreetviewPanorama#followLink.
getLocations() Array[SVLocation] Get all current locations
getPosition() GStreetviewLocation Get the current position of the Panorama
getPOV() GPov Get either the current POV of the panorama, or what the POV will be initialized to.
panoramaResized() None Automatically resize the panorama to fit the container
panTo(target:GPov) None Pan the Street View panorama around to a particlar point of view.
removeLocation(doomedLocation:SVLocation) None Remove the given location
setCurtainContents(html:) None Set the contents of the "curtain", an overlay the covers the whole of street view
setLocations(results:Array[SVLocation]) None Add a list of locations
setPanoramaSize(x:number, y:number) None Set the panorama to be a particular size
setPosition(targetLatLng:GLatLng, pov:GPov, errorCallback:Function) None Attempt to change the position of the panorama
setPOV(pov:GPov) None Works the same as jumpTo, but works instantly rather than a slow pan.
showCurtain(show:) None Set whether the "curtain" is shown.

Events

Events Arguments Description
error yaw:Mapsicle.SVErrorCodes
initialized location:GStreetviewLocation
mapsicle_click pov:GPov
mapsicle_end None
mapsicle_position_changed location:GStreetviewLocation
mapsicle_pov_changed mapsicle:Mapsicle
mapsicle_ready mapsicle:Mapsicle
mapsicle_resized size:GScreenSize
mapsicle_set_position_failed errorCode:Mapsicle.SVErrorCodes
mapsicle_set_position_jumped location:GStreetviewLocation
mapsicle_set_position_launched location:GStreetviewLocation
mapsicle_set_position_panned pov:GPov
mapsicle_set_position_success location:GStreetviewLocation
pitchchanged pitch:number
yawchanged yaw:number
zoomchanged zoom:number

class MapsicleParams

Configuration options when initializing Mapsicle. Do not use the constructor for this class, instead, instantiate it as an object literal. All of the properties (and the object itself) are optional.

Properties

Properties Type Description
avoidOverlaps boolean Whether to push tracking markers away from each other so they don't cover each other up.
normalDistance number At this distance (in metres), and any closer, a scaled marker will be displayed at full size

class SVCustomInfoWindow

Constructor

Constructor Description
SVCustomInfoWindow(params:SVCustomInfoWindowParams) An overlay that shows user-specified content.

class SVCustomInfoWindowParams

The parameters when constructing an SVCustomInfoWindow. SVCustomInfoWindowParams are not constructed: create one with an object literal containing all the necessary properties.

Properties

Properties Type Description
height number The height of the info window, in pixels
inner element A DOM element to display inside the info window
width number The width of the info window, in pixels

class SVLocation

Constructor

Constructor Description
SVLocation(params:SVLocationParams) A location derived from a lat/lng that can be followed by markers and labels.

Methods

Methods Return Value Description
distance(position:GLatLng) number Find the distance in metres between this location and another position
inFOV() boolean Is this location currently in our field of view? (Not necessarily visible, but we're facing in its direction).
latlng() GLatLng
whereOffscreen() String What direction, relative to the way we're facing, is the location? One of "left", "right", "up", "down" if the location is offscreen in that direction, "within" if visible, or "unknown" if called in a situation where it makes no sense (not registered within a Mapsicle, or no current Street View imagery)

class SVLocationParams

The parameters when constructing an SVLocation. SVLocationParams are not constructed: create one with an object literal containing all the necessary properties.

Properties

Properties Type Description
cutoff number (optional) Distance, in metres, beyond which markers and info windows are not displayed. Defaults to infinite.
goal boolean (optional) Whether the location is a goal. If so markers and info windows will be displayed beyond the cutoff in "prominent" mode. It is possible, but not recommended to have more than one goal marker.
info SVCustomInfoWindow/SVMiniInfoBox (optional) An info window: SVCustomInfoWindow or SVMiniInfoBox.
lat number Latitude
lng number Longitude
marker SVMarker (optional) A marker to be displayed hovering at this location
name String The location's name

class SVMarker

Constructor

Constructor Description
SVMarker(params:SVMarkerParams) An overlay that tracks a location with a simple icon.

class SVMarkerParams

The parameters when constructing an SVMarker. SVMarkerParams are not constructed: create one with an object literal containing all the necessary properties.

Properties

Properties Type Description
height number The height of the info window, in pixels
iconURL String The URL of the image to use as the marker
scale number (optional) If 1 or undefined, the marker will always be the same size. If less than 1, the marker will be downscaled as it gets further away until it is the given fraction of its normal size.
showOffscreen boolean (optional) For non-goal markers, whether to show their direction while offscreen.
width number The width of the info window, in pixels

class SVMiniInfoBox

Constructor

Constructor Description
SVMiniInfoBox(params:SVMiniInfoBoxParams) An overlay that shows a box with a line of text.

class SVMiniInfoBoxParams

The parameters when constructing an SVMiniInfoBox. SVMiniInfoBoxParams are not constructed: create one with an object literal containing all the necessary properties.

Properties

Properties Type Description
inner String The text to display inside the info window
width number The width of the marker, in pixels. Note that you cannot set the height.

class SVTrackingOverlay

Parent class of overlays that track an SVLocation. This class extends SVOverlay.

Methods

Methods Return Value Description
getLocation() SVLocation Get the location being tracked by this overlay.