Javascript

Below is a small example to get you started. For a more in depth example, go to : https://www.cyclomedia.com

Example
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react-dom.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.1.0/ol.js"></script>
<script type="text/javascript" src="http://streetsmart.cyclomedia.com/api/v17.1/StreetSmartApi.js"></script>
<script>
   // Here you can now call StreetSmartApi.init(), StreetSmartApi.addPanoramaViewer(),
   // or use event contents like this: StreetSmartApi.Events.panoramaViewer.RECORDING_LOADED
</script>

IntlComponent

Provides a common base class to use for internationalized components. Wraps the component using injectIntl.

ObliqueViewer

ObliqueViewer component. Do not create this component directly; use the open function.

Extends IntlComponent

Instance Members
getButtonEnabled(buttonId)
getNavbarExpanded()
getNavbarVisible()
getTimeTravelExpanded()
getTimeTravelVisible()
toggleButtonEnabled(buttonId, enabled?)
toggleNavbarExpanded(value?)
toggleNavbarVisible(visible?)
toggleTimeTravelExpanded(expanded?)
toggleTimeTravelVisible(visible?)
zoomIn()
zoomOut()

PanoramaViewer

PanoramaViewer component. Do not create this component directly; use the open function.

Extends IntlComponent

Instance Members
getButtonEnabled(buttonId)
getNavbarExpanded()
getNavbarVisible()
getOrientation()
getRecording()
getRecordingsVisible()
getTimeTravelExpanded()
getTimeTravelVisible()
getViewerColor()
lookAtCoordinate(coordinate, srs?)
off(type, callback)
on(type, callback)
openByAddress(query, srs?)
openByCoordinate(coordinate, srs?)
openByImageId(imageId, srs?)
rotateDown(deltaPitch)
rotateLeft(deltaYaw)
rotateRight(deltaYaw)
rotateUp(deltaPitch)
setOrientation(orientation = {})
toggleButtonEnabled(buttonId, enabled)
toggleNavbarExpanded(value?)
toggleNavbarVisible(visible?)
toggleRecordingsVisible(visible?)
toggleTimeTravelExpanded(expanded?)
toggleTimeTravelVisible(visible?)
zoomIn()
zoomOut()

addPanoramaViewer

Adds a PanoramaViewer to a specified DOM-element.

Deprecated: This is deprecated.
Parameters
domElement (element) DOM-element the PanoramaViewer gets rendered to.
panoramaViewerOptions (Object? = {}) Options to initialize the panorama viewer with
Name Description
panoramaViewerOptions.recordingsVisible Boolean If recordings should be visible
panoramaViewerOptions.timeTravelVisible Boolean If time travel is enabled
panoramaViewerOptions.navbarVisible Boolean If nav bar is enabled
Returns
PanoramaViewer : Returns reference to the PanoramaViewer.
Example

Add a panoramaViewer to a DOM element.

<div id="panoramaTarget"/>

// Add a PanoramaViewer to the above div. Set variable as reference.
let panoramaViewer = StreetSmartApi.addPanoramaViewer(document.getElementById('panoramaTarget'), panoramaViewerId);

destroyPanoramaViewer

Destroys panorama viewer

Deprecated: This is deprecated.
Parameters
panoramaViewer (any) instance of the PanoramaViewer you want to destroy.
domElement (any) Element of the DOM in which the PanoramaViewer was rendered.

getAddressSettings

Returns the object containing the address search settings.

Returns
{locale: (string), database: (string)} : Object containing the address settings.

getApiReadyState

Returns the current 'ready'-state of the API.

Returns
Boolean : 'ready'-state.

getApplicationName

Returns the application name of the API.

Returns
string : Application name.

getApplicationVersion

Returns the used version of the API.

Returns
string : API version number.

getDebugLogs

Returns all logs, including ones invisible to integrators.

Returns
Array<string> : Array of console logs

getPermissions

Returns the object containing functionalities that are currently permitted to use by the user.

Returns
Array : Array containing the permissions.

init

Initializes the API using the inserted values. Required to use functional viewers.

Parameters
options (Object) Object containing the options used for initializing the API.
Name Description
options.targetElement Element? DOM element to render the viewers into.
options.username string? Username of the user.
options.password string? Password of the user.
options.tid string? Password of the user.
options.apiKey string apiKey given to the user.
options.srs string EPSG code of the coordinate system used in the API. E.g. "EPSG:29882".
options.locale string? (default 'en-US') Language used as default in the API.
options.configurationUrl string? Alternate configuration url to use for all configuration services
options.addressSettings {locale: string, database: string}? The address settings to use for address searches.
locale - The locale to use. e.g. 'nl'.
database - The name of the database. e.g. 'CMDatabase'.
Returns
Promise : Returns a new promise for the result that may be used to chain additional functions.
Example

Initializing a StreetSmartApi.

<script type="text/javascript" src="src/StreetSamrtApi.js"></script>

// Set variables for initialization.
let options = {
     targetElement: document.getElementById('streetsmartApi'),
     username: "username",
     password: "password",
     srs: "EPSG:29882",
     apiKey: "XXXX-XXXX-XXXX-XXXX",
     locale: "en-US",
     addressSettings: {
         locale: "nl",
         database: "CMDatabase"
     }
};

// Initalize
StreetSmartApi.init(options).then( successCallback, errorCallback);

open

Open a panorama and/or oblique viewer using a query. The query can be a coordinate, an extent, an address or a panorama/oblique ID.

Parameters
query (string) The query

  • Coordinate: x,y E.g. '86580,437038'
  • Extent: minx,miny,maxx,maxy E.g. '86580,437038,86880,437338'
  • Address: E.g. 'Domplein, Utrecht'
  • Panorama ID: E.g. '5D4KX5SM'
  • Oblique ID: E.g. '014_0849_00135489_NOB16'
options (object)
Name Description
options.viewerType Array<ViewerType> an array indicating what kind of viewer(s) to open
options.srs string EPSG code of the spatial reference system to use
Returns
Promise<any> : When the promise resolves, it returns an array with references to the created PanoramaViewer and/or ObliqueViewer .
Example

Open a panorama viewer by ID:

StreetSmartApi.open('5D4KX5SM', {
  viewerType: [StreetSmartApi.ViewerType.PANORAMA],
  srs: 'EPSG:28992',
}).then(
  function(result) {
    if (result && result[0]) {
      console.log('Opened a panorama viewer through API!', result[0]);
    }
  }
).catch(
  function(reason) {
    console.log('Error opening panorama viewer: ' + reason);
  }
)

Open a panorama viewer and oblique viewer by address:

StreetSmartApi.open('Van Voordenpark 1, Zaltbommel', {
  viewerType: [StreetSmartApi.ViewerType.PANORAMA, StreetSmartApi.ViewerType.OBLIQUE],
  srs: 'EPSG:28992',
}).then(
  function(result) {
    if (result && result[0] && result[1]) {
      console.log('Opened a panorama viewer and oblique viewer through API!', result[0], result[1]);
    }
  }
).catch(
  function(reason) {
    console.log('Error opening viewers: ' + reason);
  }
)

startMeasurementMode

Start measurement mode for the given panorama viewer.

Parameters
panoramaViewer (object) An instance of PanoramaViewer

param (object) Optional parameter. Currently unsupported.

Example

Start measurement mode

StreetSmartApi.startMeasurementMode(panoramaViewer);

stopMeasurementMode

Stop measurement mode

Example

Stop measurement mode

StreetSmartApi.stopMeasurementMode();

Events

Object which contains event type constants for all components.

Static Members
panoramaViewer

Coordinate

Coordinate definition

Type: Array<Number>

Parameters
$0 (number) X value of the coordinate
$1 (number) Y value of the coordinate
$2 (number?) Z value of the coordinate

ObliqueViewerUi

Definition of oblique viewer UI elements

Type: Object

Properties
buttons (string) : Buttons
  • buttons.CENTER_MAP string

    Button center map on current oblique location

  • buttons.IMAGE_INFORMATION string

    Button open image information panel

  • buttons.COPY_LINK string

    Button copy link to clipboard

  • buttons.SAVE_IMAGE string

    Button save image of current view

  • buttons.ZOOM_IN string

    Zoom in button

  • buttons.ZOOM_OUT string

    Zoom out button

  • buttons.SWITCH_DIRECTION string

    Buttons for switching viewing direction

  • buttons.TOGGLE_NADIR string

    Button for toggling between Oblique and Nadir images

TIME_TRAVEL (string) : timetravel UI elements
NAVBAR (string) : toolbar

PanoramaViewerUi

Definition of panorama viewer UI elements

Type: object

Properties
buttons (string) : Buttons
  • buttons.OVERLAYS string

    Button open overlay panel

  • buttons.OPEN_OBLIQUE string

    Button open oblique on current panorama location

  • buttons.CENTER_MAP string

    Button center map on current panorama location

  • buttons.IMAGE_INFORMATION string

    Button open image information panel

  • buttons.COPY_LINK string

    Button copy link to clipboard

  • buttons.SAVE_IMAGE string

    Button save image of current view

  • buttons.ZOOM_IN string

    Zoom in button

  • buttons.ZOOM_OUT string

    Zoom out button

TIME_TRAVEL (string) : timetravel UI elements
NAVBAR (string) : toolbar
RECORDINGS (string) : recording dots

RGBA

Array of length four with four elements. r, g, b, a, respectively.

Type: Array

Properties
$0 (number) : Value of Red in rgba, between 0 and 255
$1 (number) : Value of Green in rgba, between 0 and 255
$2 (number) : Value of Blue in rgba, between 0 and 255
$3 (number) : Value of Alpha in rgba, between 0 and 1

ViewerType

Definition of viewer types

Type: Object

Properties
PANORAMA (string) : Panorama viewer
OBLIQUE (string) : Oblique viewer
MAP (string) : Map viewer