24.14.0
Below is a small example to get you started. You need a (local) webserver to get the html to work. For a more in depth example, go to: https://www.cyclomedia.com/en/code-examples
<script type="text/javascript" src="https://unpkg.com/react@18.2.0/umd/react.production.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.12.0/build/ol.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
<script type="text/javascript" src="https://streetsmart.cyclomedia.com/api/v24.9/StreetSmartApi.js" ></script>
<script>
// Here you can now call StreetSmartApi.init(), StreetSmartApi.open(),
// or use event contents like this: StreetSmartApi.Events.panoramaViewer.RECORDING_LOADED
</script>
Bugs
Story
Bugs
Story
Bugs
Story
Bugs
Story
Bugs
Story
Bugs
Story
Bugs
Story
Bugs
Story
No changes
Story Added spacing in the text values in the measurement panel Make the WFS recording functions available in the API
Story Added feature to autofill username input when log in via OAuth Improved initial pitch value when opening panorama viewer Changed delta-x and delta-y labels to width and height in the CrossSection panel
Bugs Fixed a bug that was making API crashes after clicking on destroy button Fixed a problem where some field where not being display in the information panel
Bugs Fixed a problem where height measurement was not changing color properly Corrected text in the tooltips when in the measurement mode
Story Improved the way TimeTravel fetch recordings Add improvements to selecting points during CrossSection
Bugs Fixed a bug that was making CrossSection panel display measurements mirrored Fixed a problem where CrossSection was not update the measurement units from meters to feet
Technical Story Upgrade NodeJS from Version 16 to 20
Bugs Removed amplitude code that was wrongly add to API in a previous release
Technical Story Cleanup old Crowd Smart related code Update cuid to @paralleldrive/cuid2 for Enhanced Security
Bugs Fixed a bug in the CrossSection of 3D viewer where a double click was causing the viewer to crash Fixed a problem where elevation panel was closing after changing records Removed not used WFS requests
Technical Story Replace 'lodash' with 'lodash-es' for Improved Efficiency and Tree-shaking Support
Story Measurement feedback messages were updated Improved 3D mesh viewer map measurement based on ground level Added loading indicator while loading 3D data
Bugs Prevent elevation panel to change recordings after user click in the 'up' key Fixed a bug on elevation panel that was not calculating the decimals properly Fixed a problem where attribute info was not being show from some layers Fixed a bug where measurements and elevation panel where breaking each other if one is triggered after another
Technical Story Replace deprecated execCommand('copy') for clipboard API Packages updated: chartjs-plugin-zoom, papaparse, react-autosuggest, react-chartjs-2 and xml2js
Technical Story Remove legacy polyfills and unused libraries: whatwg-fetch, blueimp-canvas-to-blob, pepjs, @babel/polyfill, resize-observer-polyfill
Story Add feature to measure CrossSection
Bugs Fix a bug that was making TIDToken not working in the API
Story Added depth tiles to SH recordings
Bugs Fixed problem with wrong call to userProfile in the API Fixed a bug that was preventing API to display point cloud Fixed a problem with projections for different overlays
Technical Story React updated to version 18
Story 3D data pipeline updated Update LiDAR/Point cloud download service
Bugs Fixed a bug that was preventing some users to log in to the API Fixed a bug in measurements after updating React 18 Fixed a problem that was opening object information panel while measuring
Bugs Fixed a bug that was not properly resting selected cyclorama during measurement Fixed problem with the Line of Sight feature of the 3D viewer
Story
Bugs
Story
Story
Bug
Bug
Story
Story
Story
Story
Story
Bug
Story
Bug
Story
Bug
Story
Bug
Bug
Story
Bug
Bug
Story
Story
Bug
Story
options
argument { viewerType: ['@@ViewerType/POINTCLOUD'] }
toggleLinkedViewers
(i.e. window.panoramaViewer[0].toggleLinkedViewers()
).Story
toggleCompass
(i.e. window.panoramaViewer[0].toggleCompass()
or window.obliqueViewer.toggleCompass()
.Story
Story
Story
Story
Story
Bug
Story
Bug
Story
Bug
Story
Bug
Story
Story
Bug
Story
Bug
Story
Bug
Story
Story
Bug
Story
Bug
Story
Bug
Story
Bug
Story
Bug
Story
Bug
Story
Bug
Bug
Story
Bug
Bug
Story
Bug
Story
Bug
Bug
Story
new options object
const query = 'Van Voordenpark 1, Zaltbommel';
const options = {
viewerType: [StreetSmartApi.ViewerType.PANORAMA, StreetSmartApi.ViewerType.OBLIQUE],
srs: 'EPSG:28992',
panoramaViewer: {
closable: true,
maximizable: true,
replace: true,
recordingsVisible: true,
navbarVisible: true,
timeTravelVisible : true,
measureTypeButtonVisible: true,
measureTypeButtonStart: true,
measureTypeButtonToggle: true,
},
obliqueViewer: {
closable: true,
maximizable: true,
navbarVisible: true,
timeTravelVisible : true,
}
};
// Open
StreetSmartApi.open(query, options).then( successCallback, errorCallback);
to stay tuned on important API updates, subscribe to our newsletter via https://www.cyclomedia.com/en/street-smart-api-newsletter
This article describes how to create an OAuth integration with the Street Smart Javascript API.
The following parts are discussed:
Type: (Vector3 | undefined)
Containing event definitions that are the same across all viewers
MeshViewer component. Do not create this component directly; use the open function.
Returns the type of this viewer.
ViewerType
: The type of this viewer.
Returns coordinates for mesh viewer location, prioritizing cameraState
Sets the texture of the meshes either to gray-scale (desaturated=true) or color
(Boolean?
= true
)
ObliqueViewer component. Do not create this component directly; use the open function.
Get the visibility of a button
(any)
Boolean
Returns the ID of this viewer
String
: The ID of this viewer.
Request the ID of a viewer:
StreetSmartApi.open('Van Voordenpark 1, Zaltbommel', {
viewerType: [StreetSmartApi.ViewerType.OBLIQUE],
srs: 'EPSG:28992',
}).then(
function(result) {
console.log(StreetSmartApi.getViewers()[0].getId());
});
Returns whether the timetravel component is visible or hidden.
Boolean
Returns whether timetravel is enabled for the ObliqueViewer.
Boolean
Returns the type of this viewer.
ViewerType
: The type of this viewer.
Downloads an image of the current oblique image.
Set the brightness of the oblique viewer.
(Number?)
set brightness to a positive number, normally use a value between 50 and 150.
Set the contrast of the oblique viewer.
(Number?)
set contrast to a positive number, normally use a value between 50 and 150.
Sets the selected feature using the given properties. The selected feature can only be selected if the feature is in the current image of the oblique viewer.
(Object)
The properties by which the feature should be determined
(string?)
The layer Id to which the feature is added
// Having StreetSmartApi intialized:
let viewer = streetSmartApi.addObliqueViewer(viewerDomElement);
var properties = {"MyAttribute1": "MyValue1", "MyAttribute2": "MyValue2"};
viewer.setSelectedFeatureByProperties(properties, layerId);
Changes the viewing direction of the oblique viewer.
(number)
Change direction (-90, 90 180).
Toggle the visibility of a button.
(ObliqueViewerUi)
(Boolean?)
if available, sets enabled to this value
Toggles the visibility of the compass in the ObliqueViewer.
(Boolean?)
if available, sets visibility to this value.
Enables/disables the ability to toggle the sidebar in the ObliqueViewer.
(Boolean?)
if available, sets visibility to this value.
Modify the state of sidebar expanded in the ObliqueViewer.
(Boolean?)
if available, sets expanded to this value.
Toggles the visibility of the sidebar in the ObliqueViewer.
(Boolean?)
if available, sets visibility to this value.
Expands or hides the timetravel components.
(Boolean?)
if available, -value for expanding or hiding time travel.
Enables or disables timetravel in the ObliqueViewer.
(Boolean?)
if available, value for enabling or disabling toggles time travel.
Zoom in in the Oblique image.
Zoom out in the Oblique image.
Toggles the visibility of the center map button in the ObliqueViewer.
Toggles the visibility of the image information in the ObliqueViewer.
selection of the features changed.
Type: Object
(string)
: event type
(Object)
: event properties
detail.layerId
Object
Id of the layer(as returned when adding the layer/overlay, empty if all the features are deselected)
detail.layerName
boolean
Name of the layer that has been changed(as provided in options when adding the layer, empty if all the features are deselected)
detail.featureProperties
boolean
properties of the feature that has been changed(empty if feature is deselected)
PanoramaViewer component. Do not create this component directly; use the open function.
Returns the ID of this viewer.
String
: The ID of this viewer.
Request the ID of a viewer:
StreetSmartApi.open('5D4KX5SM', {
viewerType: [StreetSmartApi.ViewerType.PANORAMA],
srs: 'EPSG:28992',
panoramaViewer: { replace: false, },
}).then(
function(result) {
console.log(StreetSmartApi.getViewers()[0].getId());
});
Gets the current active recording of the PanoramaViewer.
Recording
Returns the type of this viewer.
ViewerType
: The type of this viewer.
Sets the orientation of the PanoramaViewer to look at a certain coordinate.
(Coordinate)
coordinate to look at
(string?)
If provided, will use to convert coordinate to viewer srs.
Opens a panorama closest to the given address.
(string)
Address you want to search.
(string?)
Optional, coordinate system in which the panorama will be opened. E.g. "EPSG:28992"
Promise<(Recording | Error)>
: Returns a new promise for the result that may be used to chain additional functions.
Open a panorama near Cyclomedia HQ
// Having StreetSmartApi intialized:
let viewer = streetSmartApi.addPanoramaViewer(viewerDomElement);
// Now open the address]
viewer.openByAddress("Van Voordenpark 1B, Zaltbommel", "EPSG:29882").catch(function(err){ console.log(err.message)});
Opens an image by coordinates and accompanying coordinate system.
(Coordinate)
Coordinate of location to open a panorama
(string?)
If provided, will use to convert coordinate to viewer srs.
Promise<(Recording | Error)>
: Returns a new promise for the result that may be used to chain additional functions.
Opens an image by imageId.
(string)
ID of the image that needs to be opened. E.g. "5D38RPNF".
(string?)
Optional, coordinate system in which the panorama will be opened. E.g. "EPSG:28992".
Promise<(Recording | Error)>
: Returns a new promise for the result that may be used to chain additional functions.
Rotates the panorama vertically by a certain amount, as if the camera is turning to the ground.
(number)
amount to rotate the image, in degrees.
Rotates the panorama horizontally by a certain amount, as if the camera is turning to the left.
(number)
amount to rotate the image, in degrees.
Rotates the panorama horizontally by a certain amount, as if the camera is turning to the right.
(number)
amount to rotate the image, in degrees.
Rotates the panorama vertically by a certain amount, as if the camera is turning to the sky.
(number)
amount to rotate the image, in degrees.
Downloads an image of the current panorama.
Set the brightness of the panorama viewer.
(Number?)
set brightness to a positive number, normally use a value between 50 and 150.
Set the contrast of the panorama viewer.
(Number?)
set contrast to a positive number, normally use a value between 50 and 150.
Set the elevation slider level
(number)
The elevation level at which the elevation slider should be set, as a number in feet or meter
Selected feature style and interaction.
(any
= null
)
(any)
(feature) OPTIONAL, in case you want to set feature style programmatically
Sets the orientation (yaw, pitch, hFov), in degrees, of the PanoramaViewer to specific values all at once.
Sets the selected feature using the given properties. The selected feature can only be selected if the feature is in sight on the panorama viewer.
(Object)
The properties by which the feature should be determined
(string?)
The layer Id to which the feature is added
(any)
// Having StreetSmartApi intialized:
let viewer = streetSmartApi.addPanoramaViewer(viewerDomElement);
var properties = {"MyAttribute1": "MyValue1", "MyAttribute2": "MyValue2"};
viewer.setSelectedFeatureByProperties(properties, layerId);
Sets turboLoaderActive
in the Panoramaviewer Redux state
If active
param is true, no overlay http requests will be made in the panoramaviewer or in the mapviewer
(Boolean)
Toggles the visibility of the Attribute information panel, decided if it should be shown on clicking on a feature.
(Boolean?)
if available, sets visibility to this value.
Toggles the visibility of the 3D cursor in the PanoramaViewer.
(Boolean?)
if available, sets visibility to this value.
Toggles the visibility of the Address features in the PanoramaViewer.
(Boolean?)
if available, sets visibility to this value.
Toggles the visibility of the recording features in the PanoramaViewer.
(Boolean?)
if available, sets visibility to this value.
Enables/disables the ability to toggle the sidebar in the PanoramaViewer.
(Boolean?)
if available, sets visibility to this value.
Modify the state of sidebar expanded in the PanoramaViewer.
(Boolean?)
if available, sets expanded to this value.
Toggles the visibility of the sidebar in the PanoramaViewer.
(Boolean?)
if available, sets visibility to this value.
Expands or hides the timetravel components.
(Boolean?)
if available, -value for expanding or hiding time travel.
Enables or disables timetravel in the PanoramaViewer.
(Boolean?)
if available, value for enabling or disabling toggles time travel.
Returns a base64 string representation of the current canvas
any
Type: CrossSectionController
Returns whether the timetravel component is visible or hidden.
Boolean
Returns whether timetravel is enabled for the PanoramaViewer.
Boolean
Toggle the visibility of a button.
(PanoramaViewerUi)
(any)
if available, set enabled to this value
Toggles the visibility of the center map button in the PanoramaViewer.
Toggles the visibility of the image information in the PanoramaViewer.
Toggles the visibility of the link button in the PanoramaViewer.
Toggles the visibility of the mouse position in the PanoramaViewer.
Toggles the visibility of the report blurring in the PanoramaViewer.
selection of the features changed.
Type: Object
(string)
: event type
(Object)
: event properties
detail.layerId
Object
Id of the layer(as returned when adding the layer/overlay, empty if all the features are deselected)
detail.layerName
boolean
Name of the layer that has been changed(as provided in options when adding the layer, empty if all the features are deselected)
detail.featureProperties
boolean
properties of the feature that has been changed(empty if feature is deselected)
Measurement changed or added.
Type: Object
(string)
: event type
(Object)
: event properties
detail.activeMeasurement
object
The added or changed Measurement
detail.panoramaViewer
PanoramaViewer
PanoramaViewer where the measurement was changed or added
This event occurs when the 'Save measurement' button is clicked.
Type: Object
(string)
: event type
(Object)
: event properties
detail.activeMeasurement
object
The saved Measurement
detail.panoramaViewer
PanoramaViewer
PanoramaViewer where the measurement was saved
Measurement has started.
Type: Object
(string)
: event type
(Object)
: event properties
detail.activeMeasurement
object
The measurement
detail.panoramaViewer
PanoramaViewer
PanoramaViewer where the measurement was started
Measurement has stopped
Type: Object
(string)
: event type
(Object)
: event properties
detail.activeMeasurement
object
The measurement
detail.panoramaViewer
PanoramaViewer
PanoramaViewer where the measurement was done
Error loading tile(s)
Type: object
(string)
: event type
(object)
: event properties
detail.xhr
XMLHttpRequest
The XMLHttpRequest that was used to load the tile
PointcloudViewer component. Do not create this component directly; use the open function.
Get the background of the pointcloud. See the background enum.
Background
: background of the pointcloud
Get the visibility of a button.
(any)
Boolean
Get current visibility of edges around points.
Boolean
: visibility of edges around points
Get the maximal height colorization, these values are only used with the point style: Height
Number
: maximal height colorization can be between -10 and 50
Get the minimal height colorization, these values are only used with the point style: Height
Number
: minimal height colorization can be between -10 and 50
Get current point amount, see quality enum
Quality
: amount - can be 'low', 'medium' or 'high' or 'ultra'
Get current style of points
colorizationMode
: style - the style of points
Returns the type of this viewer.
ViewerType
: The type of this viewer.
Set the background. See the background enum.
(any)
(Background)
the new background
Set the maximum height colorization, this function can only be used with the point style: Height
(any)
the maximum height colorization
Set the minimum height colorization, this function can only be used with the point style: Height
(any)
the minimum height colorization
Set the maximum amount of point displayed in the viewer, see quality enum
(Quality)
can be set to 'low', 'medium' or 'high' or 'ultra'
Set the size points are displayed on, see PointSize enum.
(PointSize)
new size of points in the viewer.
Set the style of points. See colorizationMode Enum.
(colorizationMode)
new the style of points
Toggle the visibility of a button.
(PointCloudViewerUi)
(Boolean?)
if available, set enabled to this value
Toggles or sets the visibility of edges around points.
(Boolean?)
if available, set visibility to this value
Toggles between aerial point cloud and street point cloud
(any)
(PointCloudType?)
if available, sets the type of point cloud.
Initializes a new WFS recording client. This client handles loading recordings through an OGC Web Feature Service (WFS).
Extends wfsRecordingClient.WfsRecordingClient()
const recordingClient = new StreetSmartApi.WfsRecordingClient();
Initializes a new WFS third party recording client. This client handles loading third party recordings through an OGC Web Feature Service (WFS).
Extends wfsTPRecordingClient.TPRecordingClient()
const recordingClient = new StreetSmartApi.WfsRecordingClient();
Reason why we convert from world vector to pixel and then that same pixel coords back to world vector is because world vector we got from dragging events are incorrect due to draggin event calculation. We know that pixel coords are good, but for 3d movement on 2d screen, it is unable to determine where the intersection between dragging vector and depth map actually is
Bearer token changed or added.
Type: Object
Add a GeoJSON overlay to the panorama viewer. Can be removed with removeOverlay
(object)
Set of parameters for overlay
Name | Description |
---|---|
options.geojson object
|
GeoJSON object containing the layer data |
options.name string?
|
Name of the layer |
options.sourceSrs string?
|
Optional EPSG code (srs) for the source GeoJSON, if not provided, srs of API initialisation is used. |
options.sldXMLtext string?
|
Optional XML string for Styled Layer Descriptor |
options.color string?
|
Optional color string, needs to be a hexadecimal value |
options.visible boolean?
|
Optional for setting the visibility of the layer, default is true |
{id: (string)}
var options = {name: 'My GeoJSON', geojson: {}, sourceSrs: 'EPSG:28992', sldXMLtext: 'XMLstring'};
var layer = StreetSmartApi.addOverlay(options);
var layerId = layer.id
Add a WFS Layer as overlay to the panorama viewer. Can be removed with removeOverlay
(Object)
Set of parameters for overlay
Name | Description |
---|---|
options.name string
|
Name of the layer |
options.url string
|
The url where the WFS is hosted. Not needed if a remoteOWS is provided in the sld. |
options.typeName string
|
The type name of the layer. Not needed if a remoteOWS is provided in the sld. |
options.version string
|
The WFS version to be used (1.0.0, 1.1.0, 2.0.0) |
options.sldXMLtext string?
|
Optional XML string for Styled Layer Descriptor, this can contain an remoteOWS with wfs service. |
options.color string?
|
Optional color string, needs to be a hexadecimal string value |
options.authRequired boolean?
|
Whether this layer requires authentication to access |
options.credentials credentials?
|
Credentials used to access the layer. |
options.visible boolean?
|
Optional for setting the visibility of the layer, default is true |
{id: (string)}
var options = {
name: 'My Super cool layer',
url: 'http://testserver.com/geoserver/streets/wfs',
typeName: 'streets:street-center-lines',
version: '1.1.0',
color: '#00ff00',
authRequired: true,
credentials: { username: 'Mike', password: 'Tyson'}
};
var layer = StreetSmartApi.addWFSLayer(options);
var layerId = layer.id
Close a panorama or oblique viewer using a window ID (wid).
(string)
The ID of the viewer to close.
Promise<any>
: When the promise resolves, it returns an array with references to all viewers of type
PanoramaViewer
and/or
ObliqueViewer
.
Close a viewer by ID:
StreetSmartApi.open('5D4KX5SM', {
viewerType: [StreetSmartApi.ViewerType.PANORAMA],
srs: 'EPSG:28992',
panoramaViewer: { replace: false, },
}).then(
function(result) {
if (result && result[0]) {
setTimeout(() => {
StreetSmartApi.closeViewer(result[0].props.id).then(
function(res) {
if (res) {
console.log('Opened and closed a viewer, resulting in an empty list of viewers: ' + res);
}
}).catch(
function(err) {
console.log('error closing viewer: ' + err);
}
)
}, 1000);
}
}).catch(
function(reason) {
console.log('Error opening panorama viewer: ' + reason);
}
)
Destroys the API. Cleans up its event handlers and makes used memory available for garbage collection.
(Object)
Object containing the options used for destroying the API.
Name | Description |
---|---|
options.targetElement Element?
|
DOM element the viewers were rendered into. |
options.loginOauth boolean?
|
Indicates whether OAuth was used for login. true means log in was performed via OAuth. |
options.doOAuthLogoutOnDestroy boolean?
|
Indicates whether to log out with OAuth when destroy is called. true means log out with OAuth. |
Get the active measurement
Array
: Returns Array that includes Type, GeoJSON data and CRS object.
Get the active measurement data
StreetSmartApi.getActiveMeasurement();
result:
{
type: String,
features: [
geometry: Object,
properties: Object,
type: String,
],
crs: Object,
}
Returns the object containing the address search settings.
{locale: (string), database: (string)}
: Object containing the address settings.
Returns the current 'ready'-state of the API.
Boolean
: 'ready'-state.
Returns the application name of the API.
string
: Application name.
Returns the used version of the API.
string
: API version number.
Returns the Bearer token from the API.
string
: Bearer token.
Returns all logs, including ones invisible to integrators.
Array<string>
: Array of console logs
Returns the object containing functionalities that are currently permitted to use by the user.
Array
: Array containing the permissions.
Get a proj4 object. Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.
proj4
var proj4 = StreetSmartApi.getProj4();
Return an array with references to all viewers.
Array<Object>
: Returns an array with references to all viewers of type
PanoramaViewer
and/or
ObliqueViewer
.
Get opened viewers:
StreetSmartApi.open('5D4KX5SM', {
viewerType: [StreetSmartApi.ViewerType.PANORAMA],
srs: 'EPSG:28992',
replace: false,
}).then(
function(result) {
if (result && result[0]) {
const viewers = StreetSmartApi.getViewers();
console.log('Viewer Array:', viewers);
}
}).catch(
function(reason) {
console.log('Error opening panorama viewer: ' + reason);
}
)
Initializes the API using the inserted values. Required to use functional viewers. Please choose a feet or metric system like: EPSG:26918 (UTM18 - USA) or EPSG:28992 (Netherlands)
(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. It can be used both when logging in via OAuth and when logging in via basicAuth. |
options.password string?
|
Password of the user. Only used when the loginOauth value is false. |
options.loginOauth boolean?
|
Indicates to login with OAuth. true means login with OAuth. false means use basic auth. Login with OAuth will always try to execute silent authentication first, and popup authentication only in case silent authentication fails. |
options.loginOauthSilentOnly boolean?
|
Indicates to login with OAuth with silent authentication only. true means using silent authentication only. false means use silent authentication together with login popup authentication if silent authentication fails (for example when user session expired). This parameter is optional and false is default. |
options.clientId string?
|
The clientId of the user. This value only needs to be provided when logging in via oAuth. The clientId can be obtained from the helpdesk. |
options.loginRedirectUri string?
|
Optional value, the absolute / relative path to the redirect login handling of oauth. |
options.logoutRedirectUri string?
|
Optional value, the absolute / relative path to the redirect logout handling of oauth. |
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:28992". |
options.locale string
(default 'en-US' )
|
Language used as default in the API. currently we support: de, en-GB, en-US, fi, fr, nl, tr, pl |
options.overlayDrawDistance string
(default 30 )
|
max distance that is used for draw the overlays in the panorama viewer. |
options.addressSettings {locale: string, database: string}?
|
The address settings to use for address searches. |
options.configurationUrl string?
|
Deprecated - Alternate configuration url to use for all configuration services. Can be used for a local installation . locale - The locale to use. e.g. 'nl', use only 2 letter ISO-3166 country codes . database - The name of the database. e.g. 'CMDatabase'. |
Promise
: Returns a new promise for the result that may be used to chain additional functions.
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",
loginOauth: true,
loginOauthSilentOnly: true,
clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
srs: "EPSG:29882",
apiKey: "XXXX-XXXX-XXXX-XXXX",
locale: "en-US",
overlayDrawDistance: 30,
addressSettings: {
locale: "nl",
database: "CMDatabase"
}
};
// Initalize
StreetSmartApi.init(options).then( successCallback, errorCallback);
Method to add an event listener.
(Function)
Function which was set on the event listener.
StreetSmartAPI
: Returns back the instance of StreetSmartAPI so you can remove events in a chain.
Method to add an event listener.
(Function)
Function which was set on the event listener.
PanoramaViewer
: Returns back the instance of PanoramaViewer so you can remove events in a chain.
Method to add an event listener.
(Function)
Callback for event listener. Will provide an event as the first argument.
StreetSmartAPI
: Returns back the instance of StreetSmartAPI so you can add events in a chain.
Method to add an event listener.
(Function)
Callback for event listener. Will provide an event as the first argument.
PanoramaViewer
: Returns back the instance of PanoramaViewer so you can add events in a chain.
Open a panorama, oblique, point cloud viewer and/or meshviewer using a query. The query can be a coordinate, an extent, an address or a panorama/oblique ID.
(string)
The query
(object)
Name | Description |
---|---|
options.viewerType Array<ViewerType>
|
an array indicating what kind of viewer(s) to open |
options.recordingServiceType RecordingServiceType
|
value indicating what kind of service to open |
options.srs string
|
EPSG code of the spatial reference system to use |
options.panoramaViewer PanoramaViewerOptions
|
options object for PanoramaViewer options |
options.obliqueViewer ObliqueViewerOptions
|
options object for ObliqueViewer options |
options.pointcloudViewer PointcloudViewerOptions
|
options object for PointcloudViewer options |
options.meshviewer MeshViewerOptions
|
options object for MeshViewer options |
Promise<any>
: When the promise resolves, it returns an array with references to the created
PanoramaViewer
,
ObliqueViewer
and/or
MeshViewerContainer
.
Open a panorama viewer by ID:
StreetSmartApi.open('5D4KX5SM', {
viewerType: [StreetSmartApi.ViewerType.PANORAMA],
srs: 'EPSG:28992',
panoramaViewer: { replace: false, },
}).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 by coordinate and date range (this is only applicable for the panorama viewer):
StreetSmartApi.open(
{
coordinate: [121692.34, 487812.37, 5.60],
dateRange: {from: '2017-03-01', to: '2017-04-01'},
},
{
viewerType: [StreetSmartApi.ViewerType.PANORAMA],
srs: 'EPSG:28992',
panoramaViewer: { replace: false, },
}).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);
}
)
Open a aerial pointcloud viewer by coordinate:
StreetSmartApi.open(
{
coordinate: [121692.34, 487812.37, 5.60],
},
{
viewerType: [StreetSmartApi.ViewerType.POINTCLOUD],
srs: 'EPSG:28992',
pointcloudViewer: { pointCloudType: StreetSmartApi.PointCloudType.AERIAL }}).then(
function(result) {
if (result && result[0]) {
console.log('Opened a pointcloud viewer through API!', result[0]);
}
}
).catch(
function(reason) {
console.log('Error opening pointcloud viewer: ' + reason);
}
)
Open a panorama viewer and an aerial pointcloud viewer by coordinate:
StreetSmartApi.open(
{
coordinate: [121692.34, 487812.37, 5.60],
},
{
viewerType: [StreetSmartApi.ViewerType.PANORAMA, StreetSmartApi.ViewerType.POINTCLOUD],
srs: 'EPSG:28992',
panoramaViewer: { replace: false, },
pointcloudViewer: { pointCloudType: StreetSmartApi.PointCloudType.AERIAL }}).then(
function(result) {
if (result) {
console.log('Opened a pointcloud viewer and a panorama viewer through API!', result);
}
}
).catch(
function(reason) {
console.log('Error opening pointcloud viewer and panorama viewer: ' + reason);
}
)
Open a meshviewer by coordinates:
StreetSmartApi.open(
{
coordinate: [121293.08, 487400, 69],
},
{
viewerType: StreetSmartApi.ViewerType.MESHVIEWER,
srs: 'EPSG:28992',
meshviewer: {
fromViewer: StreetSmartApi.ViewerType.PANORAMA,
}
}).then(
function(result) {
if (result) {
console.log('Opened a meshviewer through the API', result);
}
}
).catch(
function(reason) {
console.log('Error opening meshviewer: ' + reason);
}
)
Open a meshviewer by imageID or address: (choose one)
StreetSmartApi.open("WE4UGIO7" || "Dam 3, Amsterdam",
{
viewerType: StreetSmartApi.ViewerType.MESHVIEWER,
srs: 'EPSG:28992',
meshviewer: {
fromViewer: StreetSmartApi.ViewerType.PANORAMA,
}
}).then(
function(result) {
if (result) {
console.log('Opened a meshviewer through the API', result);
}
}
).catch(
function(reason) {
console.log('Error opening meshviewer: ' + reason);
}
)
Remove a GeoJSON overlay from the panorama viewer
var layer = StreetSmartApi.addOverlay("My GeoJSON", {}, "EPSG:28992");
StreetSmartApi.removeOverlay(layer.id)
** EXPERIMENTAL ** Set the active measurement.
(any)
(object)
A Geojson FeatureCollection including a crs object. see
http://geojson.org/geojson-spec#coordinate-reference-system-objects
Set the active measurement data
var measurement = StreetSmartApi.getActiveMeasurement();
measurement.features[0].properties.id = 'changed_measurement'
StreetSmartApi.setActiveMeasurement(measurement);
measurement:
{
type: String,
features: [
geometry: Object,
properties: Object,
type: String,
],
crs: Object,
}
example crs:
{
type: 'name',
properties: {
name: 'EPSG:28992',
}
}
set de overlay draw distance in
(string)
var layer = StreetSmartApi.addOverlay("My GeoJSON", {}, "EPSG:28992");
StreetSmartApi.setOverlayDrawDistance(50);
Sets whether or not cursor movements will snap to nearby features while in measurement mode
(boolean)
Whether or not to enable or disable snapping
Start measurement mode for the given panorama viewer.
(object?)
Object containing measurement options.
Name | Description |
---|---|
options.geometry MeasurementGeometryTypes?
|
Bypasses the measurement mode dialog and starts measurement in the given mode. |
options.measureMethod MeasureMethods?
|
Starts the measurement with a specified measurement method. MeasureSmart, SmartClick or Forward Intersection. only applicable to panorama measurements. |
options.showSaveMeasurementButton Boolean?
|
Show the 'Save measurement' button during the measurement. note: With the button toggle: 'SAVE_MEASUREMENT' you can also enable the measurement button. You need this toggle if you want to start the measurement from the panorama viewer. |
options.recordingServiceType RecordingServiceType?
|
Type of recordings which will be used to perform measurements on. Defaults to RecordingSerivceType.DCR |
Start measurement mode without passing a geometry type. The user can then choose the measurement mode.
StreetSmartApi.startMeasurementMode(panoramaViewer);
Start measurement mode as point measurement
StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry:StreetSmartApi.MeasurementGeometryType.POINT});
Start measurement mode as distance measurement
StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry:StreetSmartApi.MeasurementGeometryType.LINESTRING});
Start measurement mode as surface measurement
StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry:StreetSmartApi.MeasurementGeometryType.POLYGON});
Start measurement mode as surface measurement, with as measure method Smart Click
StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry:StreetSmartApi.MeasurementGeometryType.POLYGON, measureMethod: StreetSmartApi.MeasureMethods.SMART_CLICK });
Start measurement mode as surface measurement, with the show measurement button visible
StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry:StreetSmartApi.MeasurementGeometryType.POLYGON, showSaveMeasurementButton: true });
Show the 'Save measurement' button during a measurement. The measurement can be started from the panorama viewer.
StreetSmartApi.open('5D4KX5SM', {
viewerType: [StreetSmartApi.ViewerType.PANORAMA],
srs: 'EPSG:28992',
replace: false,
}).then(
function(result) {
if (result && result[0]) {
const viewer = result[0];
viewer.toggleButtonEnabled(StreetSmartApi.PanoramaViewerUi.SAVE_MEASUREMENT);
}
}).catch(
function(reason) {
console.log('Error opening panorama viewer: ' + reason);
}
)
Stop measurement mode
Stop measurement mode
StreetSmartApi.stopMeasurementMode();
Update a GeoJSON overlay in the panorama viewer. Can be removed with removeOverlay
(object)
Set of parameters for overlay
Name | Description |
---|---|
options.geojson object
|
GeoJSON object containing the layer data |
options.name string?
|
Name of the layer |
options.sourceSrs string?
|
Optional EPSG code (srs) for the source GeoJSON, if not provided, srs of API initialisation is used. |
options.sldXMLtext string?
|
Optional XML string for Styled Layer Descriptor |
options.color string?
|
Optional color string, needs to be a hexadecimal value |
options.visible boolean?
|
Optional for setting the visibility of the layer, default is true |
{id: (string)}
var options = {name: 'My GeoJSON', geojson: {}, sourceSrs: 'EPSG:28992', sldXMLtext: 'XMLstring'};
var layer = StreetSmartApi.updateOverlay(options);
var layerId = layer.id
Object which contains event type constants for all components.
Names of the events that the MeshViewerContainer dispatches.
Names of the events that the obliqueViewer dispatches.
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
Names of the events that the PanoramaViewer dispatches.
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
Names of the events that the PointCloudViewer dispatches.
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
(string)
The following is required for OAuth authorization of the Street Smart API:
For a code example, See below.
What is important in the example for the OAuth implementation:
Initialization of the API:
const options = {
targetElement: document.getElementById('streetsmartApi'),
loginOauth: true,
clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
loginRedirectUri: 'redirect/login.html',
logoutRedirectUri: 'redirect/logout.html',
apiKey: 'XXXX-XXXX-XXXX-XXXX',
srs: 'EPSG:28992',
locale: 'en-US',
addressSettings: {
locale: "nl",
database: "CMDatabase"
}
};
StreetSmartApi.init(options).then(successCallback, errorCallback);
For a code example, See below. The example files login.html and login.js contain a complete working example of the login redirect handling.
The oidc-client.js file must also be placed in the same folder. That file can be found here:
login.html:
<!DOCTYPE html>
<html>
<head>
<title>Login Oauth API</title>
</head>
<body>
<script src='oidc-client.js'></script>
<script src='api-login.js'></script>
</body>
</html>
login.js:
// About logging
Oidc.Log.logger = console;
Oidc.Log.level = Oidc.Log.DEBUG;
// You will return here after you have performed the authorization.
// Now another call back has to take place to retrieve the bearer token.
new Oidc.UserManager({response_mode:'query'}).signinCallback().catch(function(err){
// If an error occurred during the callback.
Oidc.Log.logger.error("error: " + err && err.message);
});
For a code example, See below.
What is important here for the OAuth implementation:
Logout of the API:
const options = {
targetElement: document.getElementById('streetsmartApi'),
loginOauth: true,
};
StreetSmartApi.destroy(options);
For a code example, See below. The example files logout.html and logout.js contain a complete working example of the logout redirect handling
The oidc-client.js file must also be placed in the same folder. That file can be found here:
logout.html:
<!DOCTYPE html>
<html>
<head>
<title>Logout Oauth API</title>
</head>
<body>
<script src='oidc-client.js'></script>
<script src='api-logout.js'></script>
</body>
</html>
logout.js:
// About logging
Oidc.Log.logger = console;
Oidc.Log.level = Oidc.Log.INFO;
// sign out of OAuth
new Oidc.UserManager().signoutCallback();
Object which is an Interface for changing certain settings withing the api
(function)
: sets the units used to show measurement and other geological data.
(function)
: gets the units used to show measurement and other geological data.
(Object)
: Enum containing a list of available unit preferences
gets the units used to show measurement and other geological data.
string
: preference - returns the currently set unit preference
Object which is an Interface for enabeling/disabeling shortcuts
(function)
: enables the usage of a shortcut within the api.
(function)
: disables the usage of a shortcut within the api.
(Object)
: Object containing a list of available shortcut names
removes a shortcut from the list of enabledShortcuts. Can be added with enableShortcut
(string)
The name of the shortcut, as found in ShortCuts.ShortcutNames
boolean
: success - true if shortcut has been disabled, false if unknown shortcut or already disallowed.
Add a shortcut to the list of enabledShortcuts. Can be removed with disableShortcut
(string)
The name of the shortcut, as found in ShortCuts.ShortcutNames
boolean
: success - true if shortcut has been enabled, false if unknown shortcut or already allowed.
Object containing a list of available shortcut names
(String)
(String)
(String)
(String)
(String)
(String)
(String)
(String)
(String)
(String)
(String)
(String)
(String)
Defines the Background
Type: Object
Defines the PointStyles
Type: Object
Coordinate definition
Type: Object
Measurement Geometry types
Type: object
Definition of options for (3D) Meshviewer
Type: Object
(ViewerType)
: determines how the camera is set (e.g. OBLIQUE -> bird's view, PANORAMA -> streetview, etc.)
Definition of options for ObliqueViewer
Type: Object
(boolean)
: Show window close button. Default is true.
(boolean)
: Show window maximize button. Default is true.
(boolean)
: Enable viewing earlier oblique images.
(boolean)
: Show viewer navigation bar.
(boolean)
: Show viewer navigation bar.
Definition of oblique viewer UI elements
Type: Object
(Object)
: Buttons
(string)
: timetravel UI elements
(string)
: toolbar
(string)
: compass
(string)
: image information
(string)
: Button in the measurement panel, for saving the oblique measurement
(string)
: center on map current location
Definition of options for PanoramaViewer
Type: Object
(boolean)
: Show window close button. Default is true.
(boolean)
: Show window maximize button. Default is true.
(boolean)
: Replace already opened panorama viewer.
(boolean)
: Show recording dots.
(boolean)
: Enable viewing earlier recordings.
(boolean)
: Show viewer navigation bar.
(boolean)
: Show viewer navigation bar.
(boolean)
: Show measurement type button in measurement the navigation bar. Default is true.
(boolean)
: Allow toggle of measurement type in measurement the navigation bar. Default is true.
(boolean)
: Start new measurement when clicking on measurement type button in measurement the navigation bar. Default is true.
Definition of panorama viewer UI elements
Type: object
(string)
: Buttons
buttons.ELEVATION
string
Button open elevation panel
buttons.OVERLAYS
string
Button open overlay panel
buttons.OPEN_OBLIQUE
string
Button open oblique on current panorama location
buttons.OPEN_POINTCLOUD
string
Button open point cloud on current panorama location
buttons.REPORT_BLURRING
string
Button report blurring issue
buttons.MEASURE
string
Button for measuring
buttons.SAVE_IMAGE
string
Button for saving image
(string)
: timetravel UI elements
(string)
: toolbar
(string)
: recording dots
(string)
: measurements
(string)
: addresses
(string)
: search location
(string)
: Button in the measurement panel, for saving the panorama measurement
(string)
: compass
(string)
: report blurring
(string)
: image information
(string)
: link panorama viewers
(string)
: center on map current location
Definition of pointcloud viewer UI elements
Type: Object
Defines the pointSize
Type: Object
Definition of options for Point cloud viewer
Type: Object
(PointCloudType)
: type point cloud to open.
Defines the point amount
Type: Object
Array of length four with four elements. r, g, b, a, respectively.
Type: Array
Type: Object