Class: SensorLayer

Core.ModelList.Layer SensorLayer

SensorLayer

new SensorLayer()

modules/core/modelList/layer/sensor.js, line 61
This layer type requests its data from the SensorThinsgAPI (STA). The layer reacts to changes of the own features triggered by the STA. The technology used therefore is WebSocketSecure (wss) and the MessageQueuingTelemetryTransport(MQTT)-Protocol. This makes it possible to update vector-data in the application without reloading the entire page. The newest observation data of each attribute is set as follows: name = If "datastream.properties.type" is not undefined, take this. Otherwise take the value in "datastream.unitOfMeasurment.name" The attribute key is "dataStream_[dataStreamId]_[name]". All available dataStreams, their ids, their latest observation and values are separately aggregated and stored (separated by " | ") in the following attributes: dataStreamId, dataStreamName, dataStreamValue, dataStreamPhenomenonTime The "name" and the "description" of each thing are also taken as "properties".
Properties:
Name Type Default Description
url String the url to initialiy call the SensorThings-API with
epsg String "EPSG:4326" EPSG-Code for incoming sensor geometries.
utc String "+1" UTC-Timezone to calulate correct time.
version String "1.0" Version the SensorThingsAPI is requested.
useProxyUrl Boolean "1.0" Flag if url should be proxied.
Fires:
Listens to Events:

Extends

Methods

aggregateDataStreamPhenomenonTime(feature){ol/feature}

modules/core/modelList/layer/sensor.js, line 277
Aggregates the phenomenonTimes and adds them as property "dataStreamPhenomenonTime".
Name Type Description
feature ol/feature OL-feature.
Returns:
Feature with new attribute "dataStreamPhenomenonTime".

aggregateDataStreamValue(feature){ol/feature}

modules/core/modelList/layer/sensor.js, line 252
Aggregates the values and adds them as property "dataStreamValues".
Name Type Description
feature ol/feature OL-feature.
Returns:
Feature with new attribute "dataStreamValues".

aggregateProperties(thingArray, keys){Object}

modules/core/modelList/layer/sensor.js, line 670
Aggregates the properties of the given keys and joins them by " | "
Name Type Description
thingArray Object Array of things to aggregate
keys Array.<String> Keys to aggregate
Returns:
aggregatedProperties

aggregatePropertiesOfThings(allThings){Array.<Object>}

modules/core/modelList/layer/sensor.js, line 596
Aggregates the properties of the things.
Name Type Description
allThings Array.<Object> all things
Returns:
aggregatedThings

buildSensorThingsUrl(url, version, urlParams){String}

modules/core/modelList/layer/sensor.js, line 485
build SensorThings URL
Name Type Description
url String url to service
version String version from service
urlParams String url parameters
Returns:
to request sensorThings

changedConditions(){void}

modules/core/modelList/layer/sensor.js, line 81
Start or stop subscription according to its conditions. Because of usage of serveral listeners it's necessary to create a "isSubscribed" flag to prevent multiple executions.

changeTimeZone(phenomenonTime, utc){String}

modules/core/modelList/layer/sensor.js, line 302
change time zone by given UTC-time
Name Type Description
phenomenonTime String time of measuring a phenomenon
utc String timezone (default +1)
Returns:
converted with UTC

checkConditionsForSubscription(){void}

modules/core/modelList/layer/sensor.js, line 116
Check if layer is whithin range and selected to determine if all conditions are fullfilled.

inherited checkForScale(options){void}

modules/core/modelList/layer/model.js, line 119
PrĂĽft anhand der Scale ob der Layer sichtbar ist oder nicht
Name Type Description
options object -

inherited checkIfDataLayer(dataLayerId, layerId){Boolean}

modules/core/modelList/layer/model.js, line 106
Checks if dataLayerId matches the given layer id.
Name Type Description
dataLayerId String Id of dataLayer whose features are requested.
layerId String Id of current layer.
Returns:
flag if dataLayerId matches given layer id.

clearLayerSource(){Void}

modules/core/modelList/layer/sensor.js, line 996
clears all open layer features hold in the VectorSource

createClusterLayerSource(){void}

modules/core/modelList/layer/sensor.js, line 166
Creates ClusterLayerSource.

createFeatures(sensorData, epsg){Ol.Features}

modules/core/modelList/layer/sensor.js, line 214
draw points on the map
Name Type Description
sensorData array sensor with location and properties
epsg Sting from Sensortype
Returns:
to draw

createLayer(){void}

modules/core/modelList/layer/sensor.js, line 143
Creates the layer.
Listens to Events:

createLayerSource(){void}

modules/core/modelList/layer/sensor.js, line 131
Creates the vectorSource.

createLegendURL(){void}

modules/core/modelList/layer/sensor.js, line 979
create legend
Fires:

createMqttConnectionToSensorThings(features){void}

modules/core/modelList/layer/sensor.js, line 703
create connection to a given MQTT-Broker this must be passes this as a context to call the updateFromMqtt function
Name Type Description
features array features with DatastreamID

inherited decTransparency(){void}

modules/core/modelList/layer/model.js, line 394
Decreases layer transparency by 10 percent

enlargeExtent(extent, factor){ol/extent}

modules/core/modelList/layer/sensor.js, line 838
enlarge given extent by factor
Name Type Description
extent ol/extent extent to enlarge
factor float factor to enlarge extent

excludeDataStreamKeys(keys, startsWithString){Array.<String>}

modules/core/modelList/layer/sensor.js, line 652
Excludes the keys starting with the given startsWithString
Name Type Description
keys Array.<String> keys
startsWithString String startsWithString
Returns:
reducedKeys

inherited featuresLoaded(features){void}

modules/core/modelList/layer/model.js, line 134
Triggers event if vector features are loaded
Name Type Description
features Array.<ol.Feature> Loaded vector features
Fires:

inherited featureUpdated(feature){void}

modules/core/modelList/layer/model.js, line 239
Triggers event if vector feature is loaded
Name Type Description
feature ol.Feature Updated vector feature
Fires:

flattenArray(array){*}

modules/core/modelList/layer/sensor.js, line 642
flattenArray creates a new array with all sub-array elements concatenated
Name Type Description
array * the array to flatten its sub-arrays or anything else
Returns:
flattened array if an array was given, the untouched input otherwise

getDataStreamIds(features){Array.<String>}

modules/core/modelList/layer/sensor.js, line 935
get DataStreamIds for this layer - using dataStreamId property with expected pipe delimitors
Name Type Description
features Array.<ol/Feature> features with datastream ids or features with features (see clustering) with datastreamids
Returns:
- contains all datastream ids from this layer

getDataStreamIdsHelper(feature, dataStreamIdsArray){Void}

modules/core/modelList/layer/sensor.js, line 915
helper function for getDataStreamIds: pushes the datastream ids into the given array
Name Type Description
feature ol/Feature the feature containing datastream ids
dataStreamIdsArray Array.<String> the array to push the datastream ids into

getFeatureByDataStreamId(features, id){array}

modules/core/modelList/layer/sensor.js, line 963
get feature by a given id
Name Type Description
features array features to seacrh for
id number the if from examined feature

getFeaturesInExtent(){Array.<ol/featre>}

modules/core/modelList/layer/sensor.js, line 817
Returns features in enlarged extent (enlarged by 5% to make sure moving features close to the extent can move into the mapview)

getJsonGeometry(thing, index){object|null}

modules/core/modelList/layer/sensor.js, line 551
Searches the thing for its geometry location. For some reason there are two different object pathes to check.
Name Type Description
thing object aggregated thing
index integer index of location in array Locations
Returns:
object or null

getNewestSensorData(allThings){Array.<Object>}

modules/core/modelList/layer/sensor.js, line 434
Iterates over the dataStreams and creates for each datastream the attributes: "dataStream_[dataStreamId]_[dataStreamName]" and "dataStream_[dataStreamId]_[dataStreamName]_phenomenonTime".
Name Type Description
allThings Array.<Object> All things.
Returns:
All things with the newest observation for each dataStream.

inherited getResolutions(){void}

modules/core/modelList/layer/model.js, line 372
Sets visible min and max resolution on layer.
Fires:

inherited incTransparency(){void}

modules/core/modelList/layer/model.js, line 384
Increases layer transparency by 10 percent

initializeConnection(onsuccess){void}

modules/core/modelList/layer/sensor.js, line 179
Initial loading of sensor data function
Name Type Description
onsuccess function a function to call on success
Fires:

inherited intervalHandler(){void}

modules/core/modelList/layer/model.js, line 362
Callback for layer interval

inherited isLayerSourceValid(){Boolean}

modules/core/modelList/layer/model.js, line 594
Checks if the layerSource has been setup and a layersource object exist

inherited isLayerValid(){Boolean}

modules/core/modelList/layer/model.js, line 586
Checks if the layer has been setup and a layer object exist

liveUpdate(feature, dataStreamId, result, phenomenonTime){void}

modules/core/modelList/layer/sensor.js, line 891
performs the live update
Name Type Description
feature ol/feature feature to be updated
dataStreamId String dataStreamId
result String the new state
phenomenonTime String the new phenomenonTime
Fires:

loadFeaturesInExtentAndUpdateSubscription(){void}

modules/core/modelList/layer/sensor.js, line 794
loading things only in the current extent and updating the subscriptions delays before reloading stuff - maybe other moves will trigger in the midtime, so delay...

loadSensorThings(url, version, urlParams, mergeThingsByCoordinates, onsuccess){array}

modules/core/modelList/layer/sensor.js, line 341
load SensorThings by
Name Type Description
url String url to service
version String version from service
urlParams String url parameters
mergeThingsByCoordinates Boolean Flag if things should be merged if they have the same Coordinates
onsuccess function a callback function (result) with the result to call on success and result: all things with attributes and location
Returns:
things with attributes and location

loadSensorThingsComplete(){Void}

modules/core/modelList/layer/sensor.js, line 423
to call on ending of loadSensorThings
Fires:

loadSensorThingsStart(){Void}

modules/core/modelList/layer/sensor.js, line 414
to call on starting of loadSensorThings
Fires:

mergeByCoordinates(allThings){array}

modules/core/modelList/layer/sensor.js, line 519
merge things with equal coordinates
Name Type Description
allThings array contains all loaded Things
Returns:
things

inherited moveDown(){void}

modules/core/modelList/layer/model.js, line 602
Calls Collection function moveModelDown

inherited moveUp(){void}

modules/core/modelList/layer/model.js, line 610
Calls Collection function moveModelUp

parseJson(data){ol/Feature}

modules/core/modelList/layer/sensor.js, line 571
Tries to parse object to ol.format.GeoJson
Name Type Description
data object object to parse
Throws:
an error if the argument cannot be parsed.
Returns:
feature

inherited prepareFeaturesFor3D(features){void}

modules/core/modelList/layer/model.js, line 143
Prepares the given features and sets or/and overwrites the coordinates based on the configuration of "altitude" and "altitudeOffset".
Name Type Description
features Array.<ol/Feature> The olFeatures.

inherited prepareLayerObject(){void}

modules/core/modelList/layer/model.js, line 247
Process function. Calls smaller function to prepare and create layer object

inherited registerInteractionMapViewListeners(){void}

modules/core/modelList/layer/model.js, line 339
Register interaction with map view.
Listens to Events:

inherited registerInteractionTreeListeners(channel){void}

modules/core/modelList/layer/model.js, line 270
Register interaction with layer tree.
Name Type Description
channel Radio.channel Radio channel of this module
Listens to Events:

inherited removeLayer(){void}

modules/core/modelList/layer/model.js, line 784
Removes the layer from the map and the collection

inherited resetSelectionIDX(){void}

modules/core/modelList/layer/model.js, line 628
Resets selectionIDX property; 0 is defined as initial value and the layer will be acknowledged as newly added for the sake of initial positioning

inherited setAltitudeOnGeometry(geometry, altitude, altitudeOffset){ol/geom}

modules/core/modelList/layer/model.js, line 164
Sets the altitude and AltitudeOffset as z coordinate.
Name Type Description
geometry ol/geom Geometry of feature.
altitude Number Altitude. Overwrites the given z coord if available.
altitudeOffset Number Altitude offset.
Returns:
The geometry with newly set coordinates.

inherited setAltitudeOnMultiPoint(coords, altitude, altitudeOffset){Array.<Number>}

modules/core/modelList/layer/model.js, line 192
Sets the altitude on multipoint coordinates.
Name Type Description
coords Array.<Number> Coordinates.
altitude Number Altitude. Overwrites the given z coord if available.
altitudeOffset Number Altitude offset.
Returns:
newly set cooordinates.

inherited setAltitudeOnPoint(coords, altitude, altitudeOffset){Array.<Number>}

modules/core/modelList/layer/model.js, line 209
Sets the altitude on point coordinates.
Name Type Description
coords Array.<Number> Coordinates.
altitude Number Altitude. Overwrites the given z coord if available.
altitudeOffset Number Altitude offset.
Returns:
newly set cooordinates.

setClusterLayerSource(value){void}

modules/core/modelList/layer/sensor.js, line 1014
Setter for clusterLayerSource
Name Type Description
value ol/source/cluster clusterLayerSource

inherited setGlyphicon(value){void}

modules/core/modelList/item.js, line 69
Setter for glyphicon
Name Type Description
value String Glyphicon

setHttpSubFolder(value){Void}

modules/core/modelList/layer/sensor.js, line 1059
Setter for the HttpSubFolder
Name Type Description
value String the httpSubFolder as String

inherited setId(value){void}

modules/core/modelList/item.js, line 34
Setter for id
Name Type Description
value String Id

inherited setIsInThemen(value){void}

modules/core/modelList/item.js, line 78
Setter for isInThemen
Name Type Description
value Boolean Flag if item is in themen

inherited setIsJustAdded(value){void}

modules/core/modelList/layer/model.js, line 776
Setter for isJustAdded (currently only used in uiStyle = table)
Name Type Description
value Boolean Flag if layer has just been added to the tree

inherited setIsOutOfRange(value){void}

modules/core/modelList/layer/model.js, line 701
Setter for isOutOfRange
Name Type Description
value Boolean Flag if map Scale is out of defined layer minScale and maxScale

inherited setIsRemovable(value){void}

modules/core/modelList/layer/model.js, line 765
Setter for isRemovable
Name Type Description
value Boolean Flag if layer is removable from the tree

inherited setIsSelected(value){void}

modules/core/modelList/layer/model.js, line 674
Setter for isSelected
Name Type Description
value Boolean Flag if layer is selected

inherited setIsSettingVisible(value){void}

modules/core/modelList/layer/model.js, line 683
Setter for isSettingVisible
Name Type Description
value Boolean Flag if layer settings are visible

setIsSubscribed(value){void}

modules/core/modelList/layer/sensor.js, line 1023
Setter for isSubscribed
Name Type Description
value boolean isSubscribed

inherited setIsVisibleInMap(value){void}

modules/core/modelList/layer/model.js, line 664
Setter for isVisibleInMap and setter for layer.setVisible
Name Type Description
value Boolean Flag if layer is visible in map

inherited setIsVisibleInMenu(value){void}

modules/core/modelList/item.js, line 105
Setter for setIsVisibleInMenu
Name Type Description
value Boolean Flag if item is visible in menu

inherited setIsVisibleInTree(value){void}

modules/core/modelList/layer/model.js, line 746
Setter for isVisibleInTree
Name Type Description
value Boolean Flag if layer is visible in tree

inherited setLayer(value){void}

modules/core/modelList/layer/model.js, line 655
Setter for layer
Name Type Description
value ol/layer Layer

inherited setLayerInfoChecked(value){void}

modules/core/modelList/layer/model.js, line 637
Setter for layerInfoChecked
Name Type Description
value Boolean Flag if layerInfo was checked

inherited setLayerSource(value){void}

modules/core/modelList/layer/model.js, line 646
Setter for layerSource
Name Type Description
value ol/source LayerSource

inherited setLegendURL(value){void}

modules/core/modelList/layer/model.js, line 737
Setter for legendURL
Name Type Description
value String legendURL

inherited setLevel(value){void}

modules/core/modelList/item.js, line 87
Setter for level
Name Type Description
value String Level

inherited setMaxResolution(value){void}

modules/core/modelList/layer/model.js, line 710
Setter for ol/layer.setMaxResolution
Name Type Description
value Number Maximum resolution of layer

inherited setMinResolution(value){void}

modules/core/modelList/layer/model.js, line 719
Setter for ol/layer.setMinResolution
Name Type Description
value Number Minimum resolution of layer

setMoveendListener(value){void}

modules/core/modelList/layer/sensor.js, line 1041
Setter for moveendListener
Name Type Description
value boolean moveendListener

setMqttClient(value){void}

modules/core/modelList/layer/sensor.js, line 1032
Setter for mqttClient
Name Type Description
value boolean mqttClient

inherited setName(value){void}

modules/core/modelList/layer/model.js, line 728
Setter for name
Name Type Description
value String Name of layer

inherited setParentId(value){void}

modules/core/modelList/item.js, line 43
Setter for parentId
Name Type Description
value String ParentId

inherited setSelectionIDX(value){void}

modules/core/modelList/layer/model.js, line 619
Setter for selectionIDX
Name Type Description
value String SelectionIDX

inherited setSingleBaselayer(value){void}

modules/core/modelList/layer/model.js, line 756
Setter for the singleBaselayer
Name Type Description
value Boolean Flag if only a single baselayer should be selectable at once

setStyle(value){void}

modules/core/modelList/layer/sensor.js, line 1005
Setter for style
Name Type Description
value function Stylefunction.

setSubscriptionTopics(value){Void}

modules/core/modelList/layer/sensor.js, line 1050
Setter for SubscriptionTopics
Name Type Description
value Object the SubscriptionTopic as object

inherited setTransparency(value){void}

modules/core/modelList/layer/model.js, line 692
Setter for transparency
Name Type Description
value Number Tranparency in percent

inherited setType(value){void}

modules/core/modelList/item.js, line 60
Setter for type
Name Type Description
value String Type

inherited setVisible(value){void}

modules/core/modelList/layer/model.js, line 798
Setter for the layer visibility
Name Type Description
value Boolean new visibility value

inherited setWindowsInterval(func, autorefreshInterval){void}

modules/core/modelList/layer/model.js, line 354
Setter of window interval. Binds this to func.
Name Type Description
func function Function, to be executed in this
autorefreshInterval integer Intervall in ms

inherited showLayerInformation(){void}

modules/core/modelList/layer/model.js, line 555
Initiates the presentation of layer information.
Fires:

styling(isClustered){void}

modules/core/modelList/layer/sensor.js, line 687
create style, function triggers to style_v2.json
Name Type Description
isClustered boolean should
Fires:

subscribeToSensorThings(){Void}

modules/core/modelList/layer/sensor.js, line 731
subscribes to the mqtt client with the features in the current extent

inherited toggleAttributionsInterval(){void}

modules/core/modelList/layer/model.js, line 516
If attribution is defined as an object, then the attribution are requested in given intervals, as long as "isVisibleInMap" is true Is used for Verkehrslage auf den Autobahnen

inherited toggleIsSelected(){void}

modules/core/modelList/layer/model.js, line 406
Toggles the attribute isSelected. If the layer is a baselayer, the other selected baselayers are deselected.

inherited toggleIsSettingVisible(){void}

modules/core/modelList/layer/model.js, line 485
Toggles the attribute isSettingVisible

inherited toggleIsVisibleInMap(){void}

modules/core/modelList/layer/model.js, line 453
Toggles the attribute isVisibleInMap

inherited toggleLayerOnMap(){void}

modules/core/modelList/layer/model.js, line 499
Adds or removes layer from map, depending on attribute isSelected

inherited toggleWindowsInterval(){void}

modules/core/modelList/layer/model.js, line 468
Toggles the layer interval based on attribute isVisibleInMap The autoRefresh interval has to be >500 , because of performance issues

unsubscribeFromSensorThings(){Void}

modules/core/modelList/layer/sensor.js, line 753
unsubscribes from the mqtt client with topics formerly subscribed

updateFromMqtt(thing){void}

modules/core/modelList/layer/sensor.js, line 850
update the phenomenontime and states of the Feature this function is triggerd from MQTT
Name Type Description
thing json thing contains a new observation and accompanying topic

inherited updateLayerSource(){void}

modules/core/modelList/layer/model.js, line 807
refresh layerSource when updated e.g. needed because wmts source is created asynchronously

inherited updateLayerTransparency(){void}

modules/core/modelList/layer/model.js, line 541
Transforms transparency into opacity and sets opacity on layer

updateObservationForDatastreams(feature, dataStreamId, observation){Void}

modules/core/modelList/layer/sensor.js, line 870
updates the Datastreams of the given feature with received time and result of the Observation
Name Type Description
feature ol/feature feature to be updated
dataStreamId String dataStreamId
observation Object the observation to update the old observation with

updateSubscription(){void}

modules/core/modelList/layer/sensor.js, line 779
Refresh all connections by ending all established connections and creating new ones

Events

inherited changeIsOutOfRange

devtools/jsdoc/events.js, line 398
Fired if attribute isOutOfRange has changed
Name Type Description
model Backbone.Model The model whose attribute hat changed.
value Boolean The attribute value that has changed.

inherited changeIsSelected

devtools/jsdoc/events.js, line 363
Fired if attribute isSelected has changed
Name Type Description
model Backbone.Model The model whose attribute hat changed.
value Boolean The attribute value that has changed.

inherited changeIsSettingVisible

devtools/jsdoc/events.js, line 384
Fired if attribute isSettingVisible has changed
Name Type Description
model Backbone.Model The model whose attribute hat changed.
value Boolean The attribute value that has changed.

inherited changeIsVisibleInMap

devtools/jsdoc/events.js, line 370
Fired if attribute isVisibleInMap has changed
Name Type Description
model Backbone.Model The model whose attribute hat changed.
value Boolean The attribute value that has changed.

inherited changeIsVisibleInTree

devtools/jsdoc/events.js, line 391
Fired if attribute isVisibleInTree has changed
Name Type Description
model Backbone.Model The model whose attribute hat changed.
value Boolean The attribute value that has changed.

inherited changeTransparency

devtools/jsdoc/events.js, line 377
Fired if attribute transparency has changed
Name Type Description
model Backbone.Model The model whose attribute hat changed.
value Boolean The attribute value that has changed.

inherited RadioRequestVectorLayerGetFeatures

devtools/jsdoc/events.js, line 439
Name Type Description
id String Id of vector layer.
Example
Radio.request("VectorLayer", "getFeatures", id)

inherited RadioTriggerLayerSetLayerInfoChecked

devtools/jsdoc/events.js, line 411
Name Type Description
value Boolean Flag that signs that the layer informations has been checked.
Example
Radio.trigger("Layer", "setLayerInfoChecked", value)

inherited RadioTriggerLayerUpdateLayerInfo

devtools/jsdoc/events.js, line 405
Name Type Description
name String The name of the layer.
Example
Radio.trigger("Layer", "updateLayerInfo", name)

inherited RadioTriggerVectorLayerFeaturesLoaded

devtools/jsdoc/events.js, line 417
Name Type Description
id String Id of vector layer.
features Array.<ol/Feature> Features that have been loaded.
Example
Radio.trigger("VectorLayer", "featuresLoaded", id, features)

inherited RadioTriggerVectorLayerFeatureUpdated

devtools/jsdoc/events.js, line 424
Name Type Description
id String Id of vector layer.
features Array.<ol/Feature> Features that have been loaded.
Example
Radio.trigger("VectorLayer", "featureUpdated", id, features)

inherited RadioTriggerVectorLayerResetFeatures

devtools/jsdoc/events.js, line 431
Triggers an event with the features that are shown. Used for updates in heatmap after filter.
Name Type Description
id String Id of vector layer.
features Array.<ol/Feature> Features that are visible.
Example
Radio.trigger("VectorLayer", "resetFeatures", id, features)