An API for putting overlays on top of Street View
For a description and examples of how to use this library, check out the how-to.
Constructor | Description |
---|---|
Mapsicle(name:string, glatlng:GLatLng, custom:MapsicleConfig) |
Creates a new Street View Mapsicle: a street view panorama which you can overlay with markers. |
Methods | Return Value | Description |
---|---|---|
addLocation(newLocation:SVLocation) |
None |
Add a new location |
addStaticOverlay(newOverlay:SVOverlay) |
None |
Add a static overlay |
clearCallbacks(event:String) |
None |
Remove all registered callbacks on a given event |
clearLocations() |
None |
Remove all locations |
clearStaticOverlays() |
None |
Remove all the static overlays |
endStreetView() |
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. |
registerCallback(event:String, callback:Function) |
None |
Register a callback to fire when a particular event occurs. |
removeLocation(doomedLocation:SVLocation) |
None |
Remove the given location |
removeStaticOverlay(doomedOverlay:SVLocation) |
None |
Remove a static overlay |
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. |
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 |
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 | 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 |
Constructor | Description |
---|---|
SVCustomInfoWindow(params:SVCustomInfoWindowParams) |
An overlay that shows user-specified content. |
The parameters when constructing an SVCustomInfoWindow. SVCustomInfoWindowParams are not constructed: create one with an object literal containing all the necessary 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 |
Constructor | Description |
---|---|
SVLocation(params:SVLocationParams) |
A location derived from a lat/lng that can be followed by markers and labels. |
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) |
The parameters when constructing an SVLocation. SVLocationParams are not constructed: create one with an object literal containing all the necessary 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 |
SVTrackingOverlay |
(optional) An info window: SVCustomInfoWindow or SVMiniInfoBox. |
lat |
number |
Latitude |
lng |
number |
Longitude |
marker |
SVMarker |
(optional) |
name |
String |
The location's name |
Constructor | Description |
---|---|
SVMarker(params:SVMarkerParams) |
An overlay that tracks a location with a simple icon. |
The parameters when constructing an SVMarker. SVMarkerParams are not constructed: create one with an object literal containing all the necessary 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 |
Constructor | Description |
---|---|
SVMiniInfoBox(params:SVMiniInfoBoxParams) |
An overlay that shows a box with a line of text. |
The parameters when constructing an SVMiniInfoBox. SVMiniInfoBoxParams are not constructed: create one with an object literal containing all the necessary 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. |
Parent class of overlays that track an SVLocation. This class extends SVOverlay
.
Methods | Return Value | Description |
---|---|---|
tracking() |
SVLocation |
Get the location being tracked by this overlay. |