Skip to main content

Observations Layer

The MapWeave observations layer allows you to add multiple entities, such as a person or vehicle, at specific places and times. This allows you to track the movements of the entity as they move around the map. Each separate record of an entity at a place and time is called an observation.

Data Format

An example of ObservationsLayerData is as follows:

const vehicleObservations = {
entities: { vehicle1: { color: '#F2A688' } },
observations: {
vehicle1_1: {
type: 'observation',
entityId: 'vehicle1',
latitude: 49.2827,
longitude: -123.1207,
time: new Date('2024-12-16T08:00:00'),
},
vehicle1_2: {
type: 'observation',
entityId: 'vehicle1',
latitude: 49.2835,
longitude: -123.1167,
time: new Date('2024-12-16T08:05:00'),
},
vehicle1_3: {
type: 'observation',
entityId: 'vehicle1',
latitude: 49.284,
longitude: -123.1123,
time: new Date('2024-12-16T08:10:00'),
},
vehicle1_4: {
type: 'observation',
entityId: 'vehicle1',
latitude: 49.2832,
longitude: -123.1085,
time: new Date('2024-12-16T08:15:00'),
},
vehicle1_5: {
type: 'observation',
entityId: 'vehicle1',
latitude: 49.2808,
longitude: -123.106,
time: new Date('2024-12-16T08:20:00'),
},
},
};

Trajectories

MapWeave can infer the trajectory of an entity when more than one observation for an entity is recorded.

By default, MapWeave will infer a trajectory when each observation is less than 60000 milliseconds (1 minute) apart. The interval can be set using the trajectory.maximumInterval property.

Try the Observations and Trajectories example to learn more.

Tracker Nodes

Trajectories can be associated with a node on a network layer by assigning a common id to the entityId and the id of the networkNode defined in NetworkLayerData. These nodes are called tracker nodes and can be dragged along a trajectory to estimate the location of an entity at a specific time.

Set the network layer that contains the tracker node with networkLayerId and the currentTime in ObservationsLayerOptions.

See how tracker nodes are implemented in the Tracker Nodes example.