The map API gives you access to Qatium’s map environment, enabling you to create custom visualizations, move the camera, highlight assets and more.
Map Queries
getCamera()
Returns the current state of the map camera.
Method signature
Returns
An object containing:
zoom: number Zoom level
pitch: number Angle towards the horizon measured in degrees with a range between 0 and 85
bearing: 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: FlightOptionsOptional Options object that accepts:
padding: BoundsOptional Dimensions in pixels applied on each side of the viewport for shifting the vanishing point
flightDuration: numberOptional The animation’s duration, measured in milliseconds
maxZoom: numberOptional 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: numberOptional Target zoom level
pitch: numberOptional Angle towards the horizon measured in degrees with a range between 0 and 85
transitionDuration: numberOptional The animation’s duration, measured in milliseconds
latitude: numberOptional Geographic latitude following the decimal degrees format, ranging from -90 to 90
longitude: numberOptional Geographic longitude following the decimal degrees format, ranging from -180 to 180
bearing: numberOptional 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: PaddingOptional 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. Ensure each data feature has an id property for the tooltips and popovers to function correctly.
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, TooltipProperty, TooltipProperty.value, TooltipProperty.reading, and TooltipProperty.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.
addStyles()
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
elementColor?: string. Color of the line and fills of polygon features. Defaults to theme.colors.grey.250 for lines and rgba(0,0,0,0) for fills. Accepted values are tied to CSS data type
iconId?: string. Name of the icon to be used by the feature. Needs to be previously registered using registerIcon method
Examples
Highlight all tanks in yellow:
removeStyles()
Method signature
Allows you to delete the styles applied with the addStyles method.
registerIcon()
Method signature
Async. Registers an SVG icon to the map instance. Follow icon guidelines to ensure a consistent look and behavior.
Returns
A promise with success or failure message to allow async calls, resolved when the icon has been registered to mapbox.
updateIcon()
Method signature
Allows you to change the icons of elements on the map. You need to register an icon before assigning it to any element