Search

ObservationsLayer

The observations layer allows you to track entities as they move around the map. See the Observations Layer docs for more details.

ObservationsLayer

Creates a new instance of the layer.

Parameters

def
optional
object

The layer definition object.

Initial data to load into this layer. Data can be changed after instantiation via layer.data().

id

optional
string

A unique identifier for this layer. If omitted one will be generated automatically.

Initial options to set on this layer. Options can be changed after instantiation via layer.options() or layer.resetOptions().

visible

optional
boolean

Initial visibility of this layer. Visibility can be changed after instantiation via layer.visible().

readonly
string

A unique id of the layer.

Gets or sets the current data for this layer.

Parameters

data
optional

The layer data to be displayed.

Returns ObservationsLayerData

A reference to the data object it was most recently passed.

Gets the bounds of the items in the layer with the specified ids, or all items if no ids are specified. Returns null if there are no items to compute bounds for.

Parameters

ids
optional
string[]

The ids of the items to get the bounds for.

Returns LngLatBounds

Gets or sets the layer options while preserving any previously set options.

Parameters

options
optional

The layer options to be set.

Returns object

An object containing all layer options and their current values.

Overrides the style properties set in ObservedEntity and Observation.

Parameters

string | string[]

The ids of the entities and observations whose style should be overridden.

The style properties to apply to the specified items.

Returns StyleReset

A reset function that removes the style override.

Sets the provided layer options while resetting any other previously set options to default values.

Parameters

options
optional

The layer options to be set.

Returns void

Gets or sets the layer visibility.

Parameters

state
optional
boolean

Whether the layer is visible.

Returns boolean

Observation

Defines the observation of an entity at a specific place and time.

color

optional
string

The color of the observation.

string

The id of the observed entity.

number

The latitude of the observation in degrees. Should be in the range -90 to 90.

The longitude of the observation in degrees. Should be in the range -180 to 180.

number | Date

The time of the observation as a Date in local time or a millisecond number in UTC.

"observation"

The type of the item.

ObservationsItem

ObservationsItem Observation | Trajectory

An observation or trajectory that can appear in the ObservationsLayer.

ObservationsLayerData

Defines the data to load into the ObservationsLayer.

Record<string, ObservedEntity>

A dictionary of observed entities, where the keys are the entity ids and the values are ObservedEntity objects.

Record<string, Observation>

A dictionary of observations, where the keys are the observation ids and the values are Observation objects.

ObservationsLayerMode

ObservationsLayerMode "individual" | "trajectory" | "auto"

Defines how individual observations and trajectories are shown. If set to 'auto', the individual observations are displayed as defined in individual.autoRange and trajectories are displayed as defined in trajectory.autoRange.

ObservationsLayerOptions

Options related to the observations layer.

number default: 500

Time in milliseconds to change between 'individual' and 'trajectory' when ObservationsLayerMode is set to 'auto'.

number default: 0.2

The alpha value to apply to observations that are not within the timeForegroundRange.

individual

optional
object

Options applied when observations are shown individually.

autoRange

optional
object

Defines the range of zoom levels where individual observations are displayed when ObservationsLayerMode is set to 'auto'.

max
optional
number default: 22

The maximum zoom level at which individual observations are displayed. Must be in the range 0 to 22 where 0 is fully zoomed out and 22 is fully zoomed in.

min
optional
number default: 14

The minimum zoom level at which individual observations are displayed. Must be in the range 0 to 22 where 0 is fully zoomed out and 22 is fully zoomed in.

number default: 1

Minimum radius of individual observations in meters. If set alongside radiusPixels, the option that creates the largest circle will be used.

number default: 2

Radius of individual observations in pixels. If set alongside minimumRadiusMeters, the option that creates the largest circle will be used.

mode

optional
ObservationsLayerMode default: 'auto'

The mode of the observations layer.

TimeRange default: null

The time filter range. If non-null, observations will be hidden if their time is fully outside the range.

TimeRange default: null

Defines the time range of the observations to be foregrounded, which emphasizes foregrounded observations by fading the rest into the background. If set, will override timeFilterRange.

object

Options applied to tracker nodes, which are associated with an entity by a shared id. See the Tracker Nodes docs for more.

currentTime

optional
number | Date default: null

The time at which to place a tracker node on a trajectory as a Date in local time or a millisecond number in UTC.

string default: null

The id of a NetworkLayer. Nodes in NetworkLayerData with an id that matches an entityId will have their position constrained to the corresponding trajectory.

trajectory

optional
object

Options applied when observations are shown as a trajectory. See the Trajectory docs for more.

autoRange

optional
object

Defines the range of zoom levels where trajectories are displayed when ObservationsLayerMode is set to 'auto'.

max
optional
number default: 22

The maximum zoom level at which trajectories are displayed. Must be in the range 0 to 22 where 0 is fully zoomed out and 22 is fully zoomed in.

min
optional
number default: 0

The minimum zoom level at which trajectories are displayed. Must be in the range 0 to 22 where 0 is fully zoomed out and 22 is fully zoomed in.

number default: 60000

Two observations must occur in a specified time period to be considered as part of the same trajectory. This value defines this interval, in milliseconds.

number default: 0.5

Minimum width of trajectory lines in meters. If set alongside widthPixels, the option that creates the thickest line will be used.

opacity

optional
number default: 1

Opacity of trajectory lines. Must be in the range 0 to 1 where 0 is transparent and 1 is fully visible.

widthPixels

optional
number default: 1

Width of trajectory lines in pixels. If set alongside minimumWidthMeters, the option that creates the thickest line will be used.

ObservationStyle

Specifies the properties of an Observation that can be overridden with overrideStyle.

color

optional
string

The color of the observation.

ObservedEntity

Defines the entity that is observed in the ObservationsLayer. Each entity has one or more observations.

color

optional
string default: 'white'

The color of the entity shown on the map.

ObservedEntityStyle

Specifies the properties of an ObservedEntity that can be overridden with overrideStyle.

color

optional
string default: 'white'

The color of the entity shown on the map.

Trajectory

Defines an inferred path from more than one observation of the same entity.

string

The id of the entity.

The observations of the entity in time order.

"trajectory"

The type of the item.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.