new SteerpathLive(map, options)
SteerpathLive class which will monitor Steerpath live server for any asset data and visualise the data on the map. Allows overwriting certain properties of the asset data. SteerpathLive allows you to extract zone and user data from the FeatureCollection which is requested from the server
Example
var liveOptions = {
apiKey: "your_live_apiKey",
}
var steerpathLive = new steerpath.SteerpathLive(mapboxMap, liveOptions);
Properties:
Name | Type | Description |
---|---|---|
apiKey |
string | Token to be used to get Steerpath Live data |
assetData |
object | Data which is fetched from the served as GeoJSON collection. SteerpathLive renders this data automatically to the map. |
interval |
number | Interval for server requests in milli seconds. You can set the interval with method setRequestInterval() |
isMonitoring |
boolean | Boolean value to check whether or not SDK is polling the server. |
liveDataTitles |
object | Object where keys represent the assetId's and values the titles which should be shown in the map. |
liveUrl |
string | Url to be used to get Steerpath Live data |
timerId |
timerId | Timer id which is used in the server requests polling. You can cancel requests with clearTimeout(steerpathLive.timerId) |
Parameters
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
map |
Map | Represents the map on your page. | ||||||||||||||||||||||||||||||
options |
object |
Properties
|
Methods
(static) getAssetsInAllowedZones()
Get assets which are located in the allowed zones.
Asset is considered to be in the allowed zone when it's geofenceStatus property is "allowed"
You can configure each assets zone allowances through the APIs of Steerpath - Live Server
Returns
List of assets in allowed zones zones
(static) getAssetsInForbiddenZones()
Get assets which are located in the forbidden zones.
Asset is considered to be in the forbidden zone when it's geofenceStatus property is "forbidden"
You can configure each assets zone allowances through the APIs of Steerpath - Live Server
Returns
List of assets in forbidden zones
(static) getAssetsInNeutralZones()
Get assets which are located in the neutral zones.
Asset is considered to be in the neutral zone when it's geofenceStatus property is "neutral"
You can configure each assets zone allowances through the APIs of Steerpath - Live Server
Returns
List of assets in neutral zones zones
(static) getAssetsInUnknownZones()
Get assets which are located in the unknown zones.
Asset is considered to be in the unknown zone when it 's geofenceStatus property is "unknown".
You can configure each assets zone allowances through the APIs of Steerpath - Live Server
Returns
List of assets in unknown zones zones
(static) getUsers()
Get all the individual assets or users from the assetData (Steerpath Live Server's response)
Returns
Array of users or individual assets zones
(static) getUsersInZone(assetId)
- Get the users in the zone based on the zone's assetId. Users are returned as a list.
Parameters
Name | Type | Description |
---|---|---|
assetId |
string | The assetId of the zone from which you want to get the users |
Returns
Users array of the given zone.
(static) setRequestInterval(newInterval)
Set a new interval for server requests. For example setRequestInterval(2000) makes SteerpathLive fetch new server data every 2 seconds.
Parameters
Name | Type | Description |
---|---|---|
newInterval |
number | Request time interval in milliseconds |
Returns
ObjectNew interval in milliseconds
(static) setTitles(newTitles)
Set new titles for asset data. If you don't want to have titles i.e. user's names to be stored in the live server you can over written them in the client with this method.
Parameters
Name | Type | Description |
---|---|---|
newTitles |
object | Simple JSON object containing key value pairs where keys are assetId's and values the titles which should be over written. |
Returns
Object where keys represent the assetId's and values the titles which should be shown in the map near the marker.
(static) startLive()
Start SteerpathLive monitoring which will frequently request asset data and automatically draw the response FeatureCollection to the map.
You can extract zones and individual assets from this received assetData with different methods of this class. Method startLive() also sets the property
isMonitoring to true. This also fires event liveStarted.
(static) stopLive()
Stop SteerpathLive for monitoring the asset data and clears live data from the map.
Resets the properties users, zones and assetData and fires event liveStopped