interface NgwMapOptions<M, C> {
    auth?: Credentials;
    baseUrl?: string;
    bounds?: LngLatBoundsArray;
    center?: LngLatArray;
    companyLogoOptions?: CompanyLogoOptions;
    connector?: default;
    controls?: ((keyof MapControls) | C)[];
    controlsOptions?: ControlsOptions;
    create?: boolean;
    fitOptions?: FitOptions;
    highlightIdentification?: number | boolean;
    identification?: boolean;
    map?: M;
    mapAdapter?: MapAdapter<M, any, any>;
    mapAdapterOptions?: Record<string, any>;
    maxBounds?: null | LngLatBoundsArray;
    maxZoom?: number;
    minZoom?: number;
    onBeforeAddLayer?: OnBeforeLayerAdd;
    osm?: boolean;
    paint?: GeometryPaint;
    pixelRadius?: number;
    qmsId?: number | [number, string];
    resources?: NgwResourceDefinition[];
    runtimeParams?: RuntimeParams<Params, string>[];
    selectedPaint?: GeometryPaint;
    setViewDelay?: number;
    starterKits?: StarterKit[];
    target?: string | HTMLElement;
    tileJson?: TileJson;
    view?: "2D" | "3D" | "2.5D";
    webmapId?: NgwResourceDefinition;
    whitlabel?: boolean;
    withCredentials?: boolean;
    zoom?: number;
}

Type Parameters

  • M = any
  • C = any

Hierarchy (view full)

Properties

User credentials for authorization in NGW. Provides the ability to display protected resources

baseUrl?: string

Url of NGW server like this https://demo.nextgis.com

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

Overrides the center and zoom parameters. LngLatBoundsArray

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

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

companyLogoOptions?: CompanyLogoOptions
connector?: default
controls?: ((keyof MapControls) | C)[]

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.

['ZOOM', 'ATTRIBUTION']
{
controls: [
'ZOOM',
new CustomControl()
]
}
controlsOptions?: ControlsOptions

Set options for those controls that are specified by name.

{
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

false
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

highlightIdentification?: number | boolean
identification?: boolean

Get information from NGW webmap layers by click. TODO: find usage

false
@internal
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; MaplibreGL

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

osm?: boolean

Shortcut to add OSM baselayer.

pixelRadius?: number
qmsId?: number | [number, string]

Id number of resource from QMS. If specified through an array, the first element will be the resource identifier, and the second will be the name for identification in the application.

  const ngwMap = new NgwMap({qmsId: [465, 'qms-basemap']});
ngwMap.hideLayer('qms-basemap');
resources?: NgwResourceDefinition[]

List of NGW resources to be displayed on the map.

The resources list may include:

  • number - resource id; // also for resource
  • string - resource keyname; // also for resource
  • object - configuration of the layer to be added with the one required parameter resource (the comment "also for resource" above refers to it)
NgwMap.create({
baseUrl: "https://demo.nextgis.com",
target: "map",
resources: [
// Basemap resource
1665,
// Digital Elevation Model (DEM)-style
4117,
// Hillshade-style
{ resource: 4115, adapter: "TILE", opacity: 0.3 },
// Elevation contours-style
'contours-style',
// Vector from Order boundary-style
{
resource: 4111,
fit: true,
adapter: "GEOJSON",
adapterOptions: { paint: { color: "red", fill: false, weight: 4 } },
},
],
});
runtimeParams?: RuntimeParams<Params, string>[]

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

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
setViewDelay?: number
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"

Id number of webmap resource from NextGIS Web. If specified through an array, the first element will be the webmapId from NGW, and the second will be the name for identification in the application.

  const ngwMap = new NgwMap({webmapId: [3985, 'my-webmap']});
ngwMap.hideLayer('my-webmap');
whitlabel?: boolean
withCredentials?: boolean

Indicates whether to include cookies in cross-site Access-Control requests. Note that setting this property has no effect on same-origin requests.

zoom?: number

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