Skip to main content

Data Formats

Concepts in MapWeave are described as plain JavaScript objects whose properties configure its state.

The formats below describe the data structures used to define concepts in MapWeave.

CompassPoint

CompassPoint

"n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw"

The direction as shown on a compass.


FitBoundsOptions

The options for fitting the map to a provided bounding box.

Properties

bounds

optional

Defines the bounds to be shown on the map. Set the values manually or get values using the getBounds() layer methods.

padding

number

optional

default value

auto

The padding to apply to the map around the defined bounds in pixels. If not specified, defaults to a value equal to 1/8th of the minimum screen width or height.

time

number

optional

default value

0

The time of the animation in milliseconds.


FlyToOptions

The configuration for flying the map to a specific view.

Properties

bearing

number

optional

The bearing at the end of the fly to animation. If not set, preserves the previous viewState.

pitch

number

optional

The pitch at the end of the fly to animation. If not set, preserves the previous viewState.

time

number

optional

default value

1000

The duration of the fly to animation in milliseconds.

zoom

number

optional

The zoom level at the end of the fly to animation. If not set, preserves the previous viewState.


Gradient

Gradient

Record<number, string>

An object used to specify a set of color stops that defines a color gradient. The key is a number between 0 and 1, specifying the position of the color stop. The value is a string defining the color for that position.

const colorGradient = {
0: '#30C5D2',
0.5: '#743C9E',
1: '#290F85',
};

LngLat

Defines longitude and latitude in degrees from the Greenwich meridian and the equator respectively.

Properties

latitude

number

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

longitude

number

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


LngLatAlt

Defines longitude and latitude in degrees from the Greenwich meridian and the equator respectively. Altitude is defined as meters above sea level.

Properties

altitude

number

Altitude of a geographic position in meters.

latitude

number

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

longitude

number

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


LngLatBounds

Defines a rectangle on the map by the southwest and northeast corners.

Properties

northeast

The northeast corner of the bounding rectangle.

southwest

The southwest corner of the bounding rectangle.


PointerEventItem

PointerEventItem

Defines the item in the layer targeted by pointer events.


SizedViewState

An object describing the view of the map returned by MapWeave.

Properties

bearing

number

The bearing (rotation) of the map, in degrees. Set to 0 for north to be top center of the view.

height

number

Height of the viewport in pixels.

latitude

number

The latitude of the center of the map.

longitude

number

The longitude of the center of the map.

pitch

number

The pitch (tilt) of the map, in degrees. Set to 0 to view the map directly from above.

width

number

Width of the viewport in pixels.

zoom

number

The zoom level of the map.


TimeRange

Defines a time interval with a start and an end.

Properties

end

number | Date

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

start

number | Date

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


ViewState

An object to specify the view of the map.

Properties

bearing

number

The bearing (rotation) of the map, in degrees. Set to 0 for north to be top center of the view.

latitude

number

The latitude of the center of the map.

longitude

number

The longitude of the center of the map.

pitch

number

The pitch (tilt) of the map, in degrees. Set to 0 to view the map directly from above.

zoom

number

The zoom level of the map.