Map
The map
API gives you access to Qatium’s map environment, enabling you to create custom visualizations, move the camera, highlight assets and more.
Accessing the map
Once Qatium has loaded, you can access the map by using the window.qatium.map
object in your browser console:
Or by using the map object in the Plugin SDK
In the following sections, we will refer to the Map object as map
without the window.qatium
prefix.
Map Queries
getCamera()
Returns the current state of the map camera.
Method signature
Returns
An object containing:
zoom: number
Zoom levelpitch: number
Angle towards the horizon measured in degrees with a range between 0 and 85bearing: number
The direction the camera is facing, measured clockwise as an angle from true north on a compass. This can also be called a heading. In Qatium, north is 0°, east is 90°, south is 180°, and west is 270°center: {lng: number, lat: number}
The longitude and latitude at which the camera is pointed
getSelectedElement()
Returns a SelectedElement
object representing the currently selected element in the map, or undefined
if nothing is selected. The SelectedElement
object contains the element ID and the type of element.
Example
Map Actions
setHighlights()
Highlights the network elements passed as parameter (assets or zones) in elementIds
(an array of element IDs). If the elementIds
array is empty, all highlights are cleared (equivalent to using clearHighlights()
).
Method signature
Parameters
elementIds: string[]
: an array of asset / zone IDs to be highlighted
Example
Highlights two tanks in Magnetic Island:
clearHighlights()
Clears all the highlights in the map.
fitTo()
Centers the map viewport, while fitting a set of destination network elements or bounds, using the animation options set in the optional options
parameter.
Method signature
Parameters
boundsOrIds: ElementId[] | Bounds
Accepts an asset / zone id or bounds as destination.options: FlightOptions
Optional Options object that accepts:padding: Bounds
Optional Dimensions in pixels applied on each side of the viewport for shifting the vanishing pointflightDuration: number
Optional The animation’s duration, measured in millisecondsmaxZoom: number
Optional The max level of zoom allowed to perform the action
Returns
A promise with no value to allow async calls, resolved when the camera movement has finished.
Examples
Center the map to the Horseshoebay tank, using a slow animation (5 seconds), with a padding of 100 pixels on each side:
Fit a collection of assets in the viewport:
Fitting to bounds:
moveTo()
Method signature
Transitions the camera view, following a set of travel options.
Parameters
options: CameraOptions
Transition object that accepts:
zoom: number
Optional Target zoom levelpitch: number
Optional Angle towards the horizon measured in degrees with a range between 0 and 85transitionDuration: number
Optional The animation’s duration, measured in millisecondslatitude: number
Optional Geographic latitude following the decimal degrees format, ranging from -90 to 90longitude: number
Optional Geographic longitude following the decimal degrees format, ranging from -180 to 180bearing: number
Optional The direction the camera is facing, measured clockwise as an angle from true north on a compass. This can also be called a heading. In Qatium, north is 0°, east is 90°, south is 180°, and west is 270°.padding: Padding
Optional Dimensions in pixels applied on each side of the viewport for shifting the vanishing point.
Returns
A promise with no value to allow async calls, it resolves when the camera movement has finished
Examples
Move the camera to Mandalay in Magnetic Island, AU:
Do a tilted camera travel to the same location:
Animate the camera and rotate around the viewpoint:
addOverlay()
Adds a custom visual overlay on top of the map.
Method signature
Parameters
layers: List of Layer
List of layer objects containing all data and styling, from any of the supported layer types.
Where Layer is
Tooltips and Popovers
You can associate a tooltip and/or a popover with your layer. To do that you need to provide the optional tooltip
and/or popover
properties.
The main differences are that:
- Popovers appear on click and are visible until they are closed or another popover is open.
- Tooltips appear on hover and disappear on blur.
- User can see 1 popover and 1 tooltip max at the same time.
- Tooltips should be small and popovers may be a bit larger.
The property value must be a function that receives a MapItem and returns TooltipData
You can also return a Promise for Section
, TooltipPropery
, TooltipPropery.value
, TooltipPropery.reading
, and TooltipPropery.warning
Examples
Highlight all hydrants in red:
Hydrants mean pressure density with a heatmap:
Arc layer showing source and target pressures at the connections of pipes
Show tank IDs on the map
Tooltip:
Supported layers
You can refer to the DeckGL documentation to find a list of all available layers and how to declare them.
We support all available layer types except for BitmapLayer
and GeohashLayer
or custom layers.
For each layer, you’ll need to provide an object with a type
parameter with the name of the type of layer and all the relevant parameters for that specific the type of layer.
hideOverlay()
Hides/removes all the layers of the overlay
Method signature
showOverlay()
Forces all the layers in the overlay to be shown.
addSytles()
Method signature
Allows you to change the styles of elements on the map.
Parameters
styles: Styles
Transition object that needs:
assetId
: string;Style properties
:- isShadowVisible?:
boolean
: Whether the feature halo is visible. Default:false
- shadowColor?:
string
: Color of the feature halo. Default:theme.colors.primary.light
. Accepted values are tied to mapbox color specification - outlineOpacity?:
number
: Value used to show an outline around features. Default:0
- isShadowVisible?:
Examples
Highlight all hydrants in yellow:
removeSytles()
Method signature
Allows you to delete the styles applied with the addStyles method.