Search

NetworkLayer

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

Parameters

object

The data to load into the layer.

id

optional
string

A unique id of the layer. If not specified, it will be generated automatically.

The options to set on the layer.

Overrides the style properties set in NetworkLink and NetworkNode.

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, pass the state of pinned nodes in the pin prop and update it in the onDragEnd event.

ref

optional

Ref prop for use with React's useRef or createRef. This allows access to the imperative part of the layer's API.

visible

optional
boolean

Whether the layer is visible.

Returns ReactNode

A function to be imported to enable the graph engine in the network layer:

import { NetworkLayer, createNetworkGraphEngine } from 'mapweave/react/layers';

Once imported, call the function to create a graph engine instance and pass in the data to analyze it. See the Graph Analysis docs for details.

Parameters

The data to be analyzed.

Returns NetworkGraphEngine

The analyzed data.

ComboLinkDefinition

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

string

The unique identifier.

string

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

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.

A function to style the combo.

Parameters

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.

string

The unique identifier.

Record<string, NetworkNode>

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

A function to style the combo.

Parameters

Partial<NetworkNode> & object

The styling to be used.

Returns void

LngLatArray

LngLatArray [number, number]

An array that defines longitude and latitude in that order in degrees from the Greenwich meridian and the equator respectively.

NetworkGraphEngine

The graph engine instance created by createNetworkGraphEngine().

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
optional
object

directed

optional
boolean default: false.

Whether the betweenness computation should consider the direction of links.

"unnormalized" | "chart" | "component" default: '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

optional
string

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

weights

optional
boolean default: 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.

Calculates the separate 'connected components' of the graph.

Returns object[]

An array of objects in the format:

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

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
optional
object

direction

optional
"from" | "to" | "any" default: 'any'

How to treat the direction of links:

  • 'from': counts only links with arrows pointing away from nodes (out-degree).
  • 'to': counts only links with arrows pointing to nodes (in-degree).
  • 'any': counts all links regardless of whether they have arrows.

Note that to use 'from' or 'to', your graph must have arrows on links.

value

optional
string

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.

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

Parameters

string | string[]

The ids of the items whose neighbors should be found.

options
optional
object

directed

optional
boolean default: true

Whether to respect link directionality when computing neighbors.

hops

optional
number default: 1

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

Returns object

An object in the format:

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

NetworkItem

NetworkItem NetworkNode | NetworkLink

A node or link that can appear in a NetworkLayer.

NetworkItemLabel

Specifies the style of a NetworkLink.label.

string default: '#808080'

The color of the label background.

border

optional
object

The label border.

color

optional
string default: '#404040'

The border color.

radius

optional
number | [number, number, number, number] default: 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

optional
number default: 0

The border width in pixels.

color

optional
string default: 'white'

The color of the label text.

fontFamily

optional
string default: 'sans-serif'

The font family to use for the label text. Note this cannot be changed with overrideStyle.

fontSize

optional
number default: 10

The font size to use for the label text.

text

optional
string

The text to display on the label.

visible

optional
boolean default: true

Whether the label is visible. Update with overrideStyle to conditionally reveal the label.

NetworkItemStyle

NetworkItemStyle NetworkNodeStyle & NetworkLinkStyle

Specifies the style of a NetworkItem.

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.

object

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

optional
boolean default: false

Whether adaptive opacity is enabled.

number default: 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.

number default: 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.

number default: 10

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

foreground

optional
object

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

number default: 0.2

The opacity level to apply to backgrounded items.

ids

optional
string[] default: []

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

optional
object

Options related to node and link labels.

collision

optional
object

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

enabled
optional
boolean default: true

Whether hiding labels on collision is enabled.

string

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.

number default: 0

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

number default: 80

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

boolean default: 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.

optional
object

Options related to links.

optional
object

Options related to link bundling, which adjusts the paths of links by grouping the neighboring links together into bundles. Link labels are hidden and routes are disabled when bundling is enabled.

optional
boolean default: false

Whether link bundling is enabled.

optional
number default: 20000

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

When bundling is enabled, applies a color gradient to bundled links based on the relative density of the bundle. The colorGradient takes precedence over individual link colors.

optional
boolean default: false

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

optional
boolean default: false

Whether to show links as routes using any provided route geometry.

nodes

optional
object

Options related to nodes.

object

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

enabled
optional
boolean default: false

Whether adaptive scaling is enabled.

number default: 1

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

number default: 0.3

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

number default: 7

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

zoomScaling

optional
object

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

max
optional
number default: 1

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

min
optional
number default: 0

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

object

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

enabled

optional
boolean default: false

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

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

Parameters

Returns void

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

optional
number default: 16

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

TimeRange default: null

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

NetworkLayerRefProps

An instance method to return 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[]

Returns LngLatBounds

An object defining the bounds of the specified items.

An instance method to return pinned node ids and their geographic positions.

Returns NodePositions

An object containing all the pinned node ids and their geographic positions.

An instance method to return tracker node ids, their geographic positions and whether they coincide with any trajectories.

Returns TrackerNodePositions

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

Adds a temporary animated halo effect to nodes.

Parameters

string | string[]

The ids of the nodes.

options
optional

The ping options to set.

Returns void

void

NetworkLayerStyleOverride

Defines the style properties to override for the specified nodes and links.

string | string[]

The id or ids of the NetworkLink and NetworkNode items.

The style properties to apply to the specified nodes and links.

Defines a link connecting two nodes in the NetworkLayer.

optional
number default: 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.

optional
string[]

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.

optional
string default: '#808080'

The line color of the link.

optional
any

Used to store custom data for the link.

optional
object

Properties for the id1 end of the link.

optional
boolean

Whether to show an arrow at the end.

optional
object

Properties for the id2 end of the link.

optional
boolean

Whether to show an arrow at the end.

optional
object

Options for the flow animation along the link. The flow moves from id1 to id2.

optional
string default: '#ffffff'

The color of the flow animation, overlaid on the link's color.

optional
number default: 0

The velocity of the flow animation along the link in pixels per second. Use a negative number to reverse the direction of flow.

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.

A polyline defining the geographic route of the link. Enable the display of routes using showRoutes.

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

The time entry or entries associated with the link.

"link"

The type of the item.

optional
number default: 2

The line width of the link in pixels.

NetworkLinkStyle

Specifies the properties of a NetworkLink that can be overridden with overrideStyles.

color

optional
string default: '#808080'

The line color of the link.

end1

optional
object

Properties for the id1 end of the link.

arrow

optional
boolean

Whether to show an arrow at the end.

end2

optional
object

Properties for the id2 end of the link.

arrow

optional
boolean

Whether to show an arrow at the end.

flow

optional
object

Options for the flow animation along the link. The flow moves from id1 to id2.

color

optional
string default: '#ffffff'

The color of the flow animation, overlaid on the link's color.

velocity

optional
number default: 0

The velocity of the flow animation along the link in pixels per second. Use a negative number to reverse the direction of flow.

Properties for the link's label.

width

optional
number default: 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.

altitude

optional
number default: 0

The altitude of the node in meters above sea level.

border

optional
object

The node border.

color

optional
string default: '#404040'

The border color.

width

optional
number default: 0

The border width in pixels.

children

optional
string[]

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

optional
string default: '#808080'

The fill color of the node.

data

optional
any

Used to store custom data for the node.

Concentric circles drawn around the node. Add one or more.

// add a single halo as an object
halos:
 {color: 'rgb(127, 255, 127)', width: 10, radius: 15},

// add multiple halos as an array of objects
halos: [
 {color: 'rgb(127, 255, 127)', width: 10, radius: 15},
 {color: 'rgba(127, 255, 127, 0.5)', width: 10, radius: 25},
],

image

optional
object

The image on the node.

color

optional
string

The color of the non-transparent areas of the image. If not specified, the image is shown in its original color.

offsetX

optional
number default: 0

The horizontal offset for the image in pixels.

offsetY

optional
number default: 0

The vertical offset for the image in pixels.

scale

optional
number default: 1

The scale factor for the image.

url

optional
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 - can use empty objects as array placeholders

latitude

optional
number

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

longitude

optional
number

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

scale

optional
number default: 1

Scales the node size by an enlargement factor.

size

optional
number default: 6

The radius of the node in pixels.

time

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

The time entry or entries associated with the node.

"node"

The type of the item.

NetworkNodeHalo

Defines the style of NetworkNode.halos.

color

optional
string default: '#676f84'

The color of the halo.

radius

optional
number default: 12

The radius of the halo in pixels.

width

optional
number

The width of the halo in pixels.

NetworkNodeLabel

Specifies the style of a NetworkNode.label.

string default: '#808080'

The color of the label background.

border

optional
object

The label border.

color

optional
string default: '#404040'

The border color.

radius

optional
number | [number, number, number, number] default: 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

optional
number default: 0

The border width in pixels.

color

optional
string default: 'white'

The color of the label text.

fontFamily

optional
string default: 'sans-serif'

The font family to use for the label text. Note this cannot be changed with overrideStyle.

fontSize

optional
number default: 10

The font size to use for the label text.

position

optional
number | CompassPoint | "center" default: 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

optional
number

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

optional
string

The text to display on the label.

visible

optional
boolean default: true

Whether the label is visible. Update with overrideStyle to conditionally reveal the label.

NetworkNodeStyle

Specifies the properties of a NetworkNode that can be overridden with overrideStyles.

border

optional
object

The node border.

color

optional
string default: '#404040'

The border color.

width

optional
number default: 0

The border width in pixels.

color

optional
string default: '#808080'

The fill color of the node.

Concentric circles drawn around the node. Add one or more.

// add a single halo as an object
halos:
 {color: 'rgb(127, 255, 127)', width: 10, radius: 15},

// add multiple halos as an array of objects
halos: [
 {color: 'rgb(127, 255, 127)', width: 10, radius: 15},
 {color: 'rgba(127, 255, 127, 0.5)', width: 10, radius: 25},
],

image

optional
object

The image on the node.

color

optional
string

The color of the non-transparent areas of the image. If not specified, the image is shown in its original color.

offsetX

optional
number default: 0

The horizontal offset for the image in pixels.

offsetY

optional
number default: 0

The vertical offset for the image in pixels.

scale

optional
number default: 1

The scale factor for the image.

url

optional
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 - can use empty objects as array placeholders

scale

optional
number default: 1

Scales the node size by an enlargement factor.

size

optional
number default: 6

The radius of the node in pixels.

NetworkRoute

NetworkRoute LngLatObject[] | LngLatArray[]

Defines the route of a link connecting two nodes.

NodePositions

NodePositions Record<string, LngLatAlt>

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

PingOptions

Defines the style of a ping animation.

color

optional
string default: '#ff6d66'

The color of the ping circle.

haloRadius

optional
number default: 30

The radius of the ping halo at the end of the animation in pixels.

haloWidth

optional
number default: 8

The width of the ping halo at the end of the animation in pixels.

repeat

optional
number default: 10

The number of times the ping animation repeats.

time

optional
number default: 800

The duration of the ping animation in milliseconds.

TrackerNodePosition

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

number

Altitude of a geographic position in meters.

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

number

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

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

TrackerNodePositions

TrackerNodePositions Record<string, TrackerNodePosition>

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

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.