Interface MapOptions<M, C>

Type Parameters

  • M = any

  • C = any

Hierarchy

Properties

Initial extent of the map, array of degrees in [west, south, east, north] order.

Remarks

Overrides the center and zoom parameters. LngLatBoundsArray

Example

// whole world
bounds: [0, -90, 180, 90]
center?: LngLatArray

Initial position of the map, array of two degrees [longitude, latitude]. LngLatArray

controls?: (C | keyof MapControls)[]

List of controls that will be initialized when creating a map instance. It can be defined as a string, then points to the corresponding entry in the controlAdapters.

Default Value

['ZOOM', 'ATTRIBUTION']

Example

{
controls: [
'ZOOM',
new CustomControl()
]
}
controlsOptions?: ControlsOptions<MapControls, keyof MapControls>

Set options for those controls that are specified by name.

Example

{
controls: ['ZOOM', 'button1', 'button2'],
controlsOptions: {
'ZOOM': { position: 'top-right' },
'button1': { control: 'BUTTON', position: 'top-left' },
'button2': { control: 'BUTTON' },
}
}
create?: boolean

Аutomatic creation of a map from the constructor

Default Value

false

Example

const webMap = new WebMap(options);
// create: false
webMap.create().then(() => doSomething());
// create: true
webMap.emitter.on('created', () => doSomething());
fitOptions?: FitOptions

options to specify the initial position of the map

map?: M

A pre-initialized instance of the map

mapAdapter?: MapAdapter<M, any, any>

The main initialization property of WebMap. Determines the way of interaction with the selected GIS framework. Available: Leaflet; Openlayers; MapboxGL

mapAdapterOptions?: Record<string, any>

special settings for the selected map adapter

maxBounds?: null | LngLatBoundsArray
maxZoom?: number

The maximum zoom level of the map (0-24).

minZoom?: number

The minimum zoom level of the map (0-24).

onBeforeAddLayer?: OnBeforeLayerAdd

The callback function is calling before adding each layer

runtimeParams?: RuntimeParams[]

A way to save the state of a map to external services

Example

import RuntimeParams from '@nextgis/url-runtime-params';
// this will allow to write in the url params of map center and zoomlevel when moving
new WebMap({
mapAdapter: new MapAdapter(),
runtimeParams: [new RuntimeParams]
})
selectedPaint?: GeometryPaint
starterKits?: StarterKit[]

One way to extend WebMap functionality with the help of kits.

target?: string | HTMLElement

The HTML element in which NgwMap will render the map, or the element's string id. The specified element must have no children.

tileJson?: TileJson
view?: "2D" | "3D" | "2.5D"
zoom?: number

The initial zoom level of the map (0-24).

Generated using TypeDoc