Skip to main content

NetworkLayer

Description

The network layer visualizes connected data as nodes and links. See the Network Layer docs for details.

NetworkLayer

Constructors

new NetworkLayer(def)

Creates a new instance of the layer.

Parameters

def

object

optional

The layer definition object.

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

id

string

optional

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

options

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

visible

boolean

optional

Initial visibilty of this layer. Visibilty can be changed after instantiation via layer.visible().

Properties

id

string

readonly

A unique id of the layer.

Methods

data(data)

Gets or sets the current data for this layer.

Parameters

The layer data to be displayed.

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

getGraphEngine()

Runs the graph engine on this layer.

The analyzed data.

getTrackerNodePositions()

Get the tracker nodes and their geographic positions.

An object containing the tracker nodes, their geographic positions and whether they coincide with any trajectories.

options(options)

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

Parameters

options

The layer options to be set.

Returns
object

An object containing all layer options and their current values.

pin(newPins)

Pins the specified nodes on the map. When you drag a pinned node and release it, the pin is removed. To keep the pin in place, call pin() in the handler of the drag-end event.

Parameters

newPins

The nodes to be pinned.

An object containing all the pinned nodes and their coordinates.

resetOptions(options)

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

Parameters

options

The layer options to be set.

Returns
void

visible(state)

Gets or sets the layer visibility.

Parameters

state

boolean

optional

Whether the layer is visible.

Returns
boolean

static createGraphEngine(data)

Creates a new instance of the graph engine.

Parameters

The data to be analyzed.

The analyzed data.


ComboLinkDefinition

A definition of a combo link returned by the onCombineLinks function. See the Proximity combining docs for details.

Properties

id

string

The unique identifier.

id1

string

The identity of the node at one end of the combo link.

id2

string

The identity of the node at the other end of the combo link.

Record<string, NetworkLink>

A dictionary of links included in the combo link, indexed by link id.

setStyle

(style) => void

A function to style the combo.

Parameters

style

Partial<NetworkLink> & object

The styling to be used.

Returns
void

ComboNodeDefinition

A definition of a combo link returned by the onCombineNodes function. See the Proximity combining docs for details.

Properties

id

string

The unique identifier.

nodes

Record<string, NetworkNode>

A dictionary of nodes included in the combo node, indexed by node id.

setStyle

(style) => void

A function to style the combo.

Parameters

style

Partial<NetworkNode> & object

The styling to be used.

Returns
void

NetworkGraphEngine

The graph engine returned by getGraphEngine or createGraphEngine functions.

Methods

betweenness(options)

Measures the number of times a node lies on the shortest path between other nodes. Shows important nodes that would have the greatest impact on the network connectivity if removed.

Parameters

options

object

optional

normalization

"unnormalized" | "chart" | "component"

optional

default value

'component'

Defines how the results should be normalized. Normalization divides the results to ensure that values are between 0 and 1. This avoids extremes and creates a more proportional range e.g. for styling.

  • 'chart' - Divides the scores of all nodes in the graph by a single value.
  • 'component' - Divides the scores of each unconnected part of a graph separately and by a different value.
  • 'unnormalized' - No normalization is used.

value

string

optional

The key of the custom data value on the node's data property that defines each link's length.

weights

boolean

optional

default value

false

If true, the path length of any link is the reciprocal of the value ( 1 / value ).

Returns
Record<string, number>

A dictionary of items where the keys are the node ids and the values are their betweenness values.

components()

Calculates the separate 'connected components' of the graph.

Returns
object[]

An array of objects in the format:

[
{ nodeIds: [...], linkIds: [...] },
{ nodeIds: [...], linkIds: [...] },
...
]

degrees(options)

Measures the number of direct, 'one hop' connections each node has to other nodes within the network. Shows very connected nodes which can quickly connect with the wider network.

Parameters

options

object

optional

value

string

optional

The key of the custom data value on the node's data property that defines each link's value.

Returns
Record<string, number>

A dictionary of items where the keys are the node ids and the values are their degrees values.

neighbors(ids, options)

Finds the nodes that are linked to the node or nodes passed in.

Parameters

ids

string | string[]

The ids of the items whose neigbors should be found.

options

object

optional

hops

number

optional

default value

1

How far away can neighbors be from the passed id(s).

Returns
object

An object in the format:

{ nodeIds: [...], linkIds: [...] }

NetworkItem

A node or link that can appear in a NetworkLayer.


NetworkItemLabel

Specifies the style of a link label.

Properties

backgroundColor

string

optional

default value

'#808080'

The color of the label background.

border

object

optional

The label border.

color
string

optional

default value

'#404040'

The border color.

radius
number | [number, number, number, number]

optional

default value

20

The outer radius for label border corners. Specified in pixels as a single number or an array of four numbers. If an array is used, the corners are defined in the order of top left, top right, bottom right and bottom left.

width
number

optional

default value

0

The border width in pixels.

color

string

optional

default value

'white'

The color of the label text.

fontFamily

string

optional

default value

'sans-serif'

The font family to use for the label text.

fontSize

number

optional

default value

10

The font size to use for the label text.

text

string

optional

The text to display on the label.


NetworkLayerData

NetworkLayerData

Record<string, NetworkItem>

A dictionary of items to be displayed in a NetworkLayer, where the keys are item ids and the values are NetworkItem objects.


NetworkLayerOptions

Options related to the network layer.

Properties

adaptiveOpacity

object

optional

Options related to adaptive opacity, which changes the opacity of nodes and links to highlight the most important items. Nodes are assigned an opacity based on their internally calculated betweenness score which can be adjusted for zoom level. Links match the highest opacity of their associated nodes.

enabled
boolean

optional

default value

false

Whether adaptive opacity is enabled.

fullOpacityZoom
number

optional

default value

10

The zoom level at which the item opacity level will be at 100% and all items will be fully visible. Must be in the range 0 to 22 where 0 is fully zoomed out and 22 is fully zoomed in.

minimumOpacity
number

optional

default value

0.004

The minimum opacity applied when adaptive opacity is enabled. Must be in the range 0 to 1 where 0 is transparent and 1 is fully visible.

nodeCountThreshold
number

optional

default value

10

The number of visible nodes over which opacity fades to minimumOpacity.

foreground

object

optional

Options related to foregrounding and backgrounding of nodes and links, which emphasizes foregrounded items by fading the rest into the background.

backgroundOpacity
number

optional

default value

0.2

The opacity level to apply to backgrounded items.

ids
string[]

optional

default value

[]

The id(s) of item(s) to be foregrounded. If specified, the items not included in the array are backgrounded. If empty, all items are foregrounded.

labels

object

optional

Options related to node and link labels.

collision
object

optional

Options related to label collision, which hides labels that overlap with other labels.

enabled
boolean

optional

default value

true

Whether hiding labels on collision is enabled.

priorityProp
string

optional

The name of the custom property on the node's data or link's data properties that defines the collision priority of a label. The property must contain a numeric value in the range -1000 to 1000. Labels with higher values will be drawn over those with lower ones.

minLabelSize
number

optional

default value

0

Minimum height of a label required to draw it, in pixels.

minLinkLength
number

optional

default value

80

Minimum length of a link required to draw its label, in pixels.

screenFacing
boolean

optional

default value

false

If view has a pitch or bearing set manually or if viewRotation is enabled, defines how the labels are oriented in relation to the user's screen. If true, the labels face the user's screen. If false, the labels lie flat on the surface of the map.

object

optional

Options related to links.

object

optional

Options related to link bundling, which adjusts the paths of links by grouping the neigboring links together into bundles.

boolean

optional

default value

false

Whether link bundling is enabled.

number

optional

default value

20000

The maximum number of links for which link bundling is applied.

optional

Applies a color gradient to links based on the internally calculated betweenness scores of their nodes. Overrides individual link colors if set.

boolean

optional

default value

false

If true, links are drawn as arcs along great circle paths to represent the shortest distance in 3D space.

nodes

object

optional

Options related to nodes.

adaptiveScaling
object

optional

Options related to adaptive scaling of nodes, which sizes nodes based on their internally calculated betweenness scores.

enabled
boolean

optional

default value

false

Whether adaptive scaling is enabled.

fixedMinScale
number

optional

default value

1

Minimum scale for a unique (i.e. all pairwise similarities = 0) fixed (geolocated) node.

floatingMinScale
number

optional

default value

0.3

Minimum scale for a unique (i.e. all pairwise similarities = 0) free (non-geolocated) node.

minImageSize
number

optional

default value

7

Minimum size for a node image to be displayed, in pixels.

zoomScaling
object

optional

Options related to scaling of nodes based on the current zoom level.

max
number

optional

default value

1

Amount of scale factor to add to each node when zoomed all the way in.

min
number

optional

default value

0

Amount of scale factor to add to each node when zoomed all the way out.

proximityCombine

object

optional

Options related to combining nodes and links based on their proximity to each other at a given zoom level.

enabled
boolean

optional

default value

false

Whether combining of fixed (geo-located) nodes and their links is enabled.

(comboLink) => void

optional

A function called by the NetworkLayer when a combo link is created. Use it to style the combo link.

Parameters

An object containing the information about the created combo link and a setStyle styling function.

Returns
void
onCombineNodes
(comboNode) => void

optional

A function called by the NetworkLayer when a combo node is created. Use it to style the combo node.

Parameters

An object containing the information about the created combo node and a setStyle styling function.

Returns
void
radius
number

optional

default value

16

The distance threshold that determines which nodes are grouped together, in pixels.

timeFilterRange

optional

default value

null

The time filter range. If non-null, items will be hidden if all their timestamps are outside the range.


Defines a link connecting two nodes in the NetworkLayer.

Properties

number

optional

default value

0

A multiplier of link height. The default value of 0 creates flat links. If set to a higher value, the link is shown as a 3D arc raised above the map surface. The height multiplier is based on the distance between the two ends.

string[]

optional

If used with a combo link, lists the child links contained within this combo link. This property is only used when accessing combo links created via proximityCombine.

string

optional

default value

'#808080'

The line color of the link.

any

optional

Used to store custom data for the link.

string

The identity of the node at one end of the link.

string

The identity of the node at the other end of the link.

Properties for the link's label.

number | Date | TimeRange | (number | Date | TimeRange)[]

optional

The time entry or entries associated with the link.

"link"

The type of the item.

number

optional

default value

2

The line width of the link in pixels.


NetworkNode

Defines a node in the NetworkLayer that can be connected to other nodes using links.

Properties

altitude

number

optional

default value

0

The altitude of the node in meters above sea level.

border

object

optional

The node border.

color
string

optional

default value

'#404040'

The border color.

width
number

optional

default value

0

The border width in pixels.

children

string[]

optional

If used with a combo node, lists the child nodes contained within this combo node. This property is only used when accessing combo nodes created via proximityCombine.

color

string

optional

default value

'#808080'

The fill color of the node.

data

any

optional

Used to store custom data for the node.

image

object

optional

The image on the node.

color
string

optional

The background color around the image. If not specified, the value in color is used.

offsetX
number

optional

default value

0

The horizontal offset for the image in pixels.

offsetY
number

optional

default value

0

The vertical offset for the image in pixels.

scale
number

optional

default value

1

The scale factor for the image.

url
string

The URL of the node image. Unavailable images are shown as a blue X. If requesting images directly from external domains, consider restrictions on Cross-Origin Resource Sharing.

The label or labels on the node.

latitude

number

optional

The latitude of a fixed (geolocated) node in degrees. Should be in the range -90 to 90.

longitude

number

optional

The longitude of a fixed (geolocated) node in degrees. Should be in the range -180 to 180.

scale

number

optional

default value

1

Scales the node size by an enlargement factor.

size

number

optional

default value

6

The radius of the node in pixels.

time

number | Date | TimeRange | (number | Date | TimeRange)[]

optional

The time entry or entries associated with the node.

type

"node"

The type of the item.


NetworkNodeLabel

Specifies the style of a node label.

Properties

backgroundColor

string

optional

default value

'#808080'

The color of the label background.

border

object

optional

The label border.

color
string

optional

default value

'#404040'

The border color.

radius
number | [number, number, number, number]

optional

default value

20

The outer radius for label border corners. Specified in pixels as a single number or an array of four numbers. If an array is used, the corners are defined in the order of top left, top right, bottom right and bottom left.

width
number

optional

default value

0

The border width in pixels.

color

string

optional

default value

'white'

The color of the label text.

fontFamily

string

optional

default value

'sans-serif'

The font family to use for the label text.

fontSize

number

optional

default value

10

The font size to use for the label text.

position

number | CompassPoint | "center"

optional

default value

180

The label position:

  • number - an integer number of degrees clockwise from the top
  • CompassPoint - e.g. 'n', 'ne' or 'se'
  • "center" - positions the label at the center of the node

radius

number

optional

The distance between the node and the label. Measured from the node center to the closest point of the label to the node center. If not specified, the label is placed at the edge of the node. Ignored if position is "center".

text

string

optional

The text to display on the label.


NodePositions

NodePositions

Record<string, LngLatAlt>

A dictionary of nodes, where the keys are node ids and the values are LngLatAlt objects.


TrackerNodePosition

Defines the geographic position of a tracker node and whether it coincides with any trajectories.

Properties

altitude

number

Altitude of a geographic position in meters.

isInTrajectory

boolean

Whether a tracker node has a geographic position that coincides with any trajectories. If true, the tracker node is visible.

latitude

number

Longitude of a geographic position in degrees [-180°, 180°].

longitude

number

Latitude of a geographic position in degrees [-90°, 90°].


TrackerNodePositions

TrackerNodePositions

Record<string, TrackerNodePosition>

A dictionary of nodes, where the keys are node ids and the values are TrackerNodePosition objects.