Protected
_initProtected
Readonly
_starterReadonly
emitterReadonly
keysReadonly
mapReadonly
runtimeStatic
getStatic
keysProtected
_addProtected
_emitProtected
_onShortcut method to create base layer
Optional
options: O | LayerAdaptersOptions[K]Shortcut for addGeoJsonLayer to create GeoJson adapter with generic types for working in typescript
Create layer from GeoJson data. Set style and behavior for selection.
// Add simple layer
webMap.addGeoJsonLayer({ data: geojson, paint: { color: 'red' } });
// Add styled by feature property layer with selection behavior
webMap.addGeoJsonLayer({
data: geojson,
paint: function (feature) {
return { color: feature.properties.color, opacity: 0.5 }
},
selectedPaint: function (feature) {
return { color: feature.properties.selcolor, opacity: 1 }
},
selectable: true,
multiselect: true
});
// Add marker layer styled with use [Icons](icons)
webMap.addGeoJsonLayer({ data: geojson, paint: webMap.getIcon({ color: 'orange' })});
// work with added layer
const layer = webMap.addGeoJsonLayer({ data: geojson, id: 'my_layer_name'});
// access layer by id
webMap.showLayer('my_layer_name');
// or access layer by instance
webMap.showLayer(layer);
Optional
adapter: LayerAdapterDefinition<K>Shortcut for addLayer to create TileLayer adapter
Registration of map layer.
webMap.addLayer('TILE', options).then((layer) => webMap.showLayer(layer));
webMap.addLayer(CustomLayerAdapter, options);
The name of layer adapter from MapAdapter.layerAdapters. May be custom object or class implemented by MainLayerAdapter.
Specific options for given adapter
Optional
order: numberPush new the GeoJSON features into given vector layer.
const layer = webMap.addLayer('GEOJSON', {data: geojson_features_5}).then((layer) => {
console.log(layer.getLayers().length) // > 5;
webMap.addLayerData(layer, geojson_features_3);
console.log(layer.getLayers().length) // > 8;
});
Optional
order: numberShortcut for addLayer to create TileLayer adapter
Remove from vector layer all features. it is possible to remove only some objects if you specify a callback function.
const layer = webMap.addLayer('GEOJSON', {data: geojson}).then((layer) => {
webMap.clearLayerData(layer, (feture) => feture.id === 42);
webMap.clearLayerData(layer);
});
Optional
cb: ((feature) => boolean)Manual way to create a map (If create is false
).
const webMap = new WebMap(options);
webMap.create().then(() => doSomething());
Hide features from a vector layer using a callback function.
const layer = webMap.addLayer('GEOJSON', {data: geojson}).then((layer) => {
webMap.filterLayer(layer, ({feature}) => feature.id === '42');
});
Sets a map view that contains the given geographical bounds.
// Whole world
webMap.fitBounds([0, -90, 180, 90]);
Array of coordinates, measured in degrees, in [west, south, east, north] order.
Optional
options: FitOptionsTry to fit map view by given layer bounds. But not all layers have borders
Optional
options: FitOptionsReturns the map's geographical centerpoint.
lngLat Array of two numbers representing longitude and latitude of the center of the map view.
// Mount Everest 27° 59′ 17″ N, 86° 55′ 31″ E
webMap.getCenter(); // [86.925278, 27.988056]
Checking the status of any asynchronous operation
var webMap = new WebMap(options);
webMap.getEventStatus('create'); // false
webMap.emitter.on('create', function () {
webMap.getEventStatus('create'); // true
})
The name of the event whose status is checked
Helper method to return added layer object by any definition type.
Helper method to return added layer identificator by any definition type.
Hide added layer on the map by it definition.
Check if given layer is baselayer
Check if the given layer on the map
Optional
events: LocationEventshelper method to wait for events to load. By default, card creation is tracked
var webMap = new WebMap(options);
webMap.onLoad().then(function () {
webMap.getEventStatus('create'); // true
})
// use async/await syntax
async function () {
await webMap.onLoad();
doSomething();
}
The name of the event whose status is checked
Optional
cb: ((mapAdapter) => void)Optional
options: FilterOptions<{ Remove specific layer from map and memory by its definition.
Remove all layer from map and memory.
Optional
allowCb: ((layer, adapter) => boolean)Mark the layer as selected. If the adapter is a vector layer and supports data selection, you can pass a callback function to specify which data will be selected.
const layer = webMap.addLayer('GEOJSON', {data: geojson}).then((layer) => {
webMap.selectLayer(layer, ({feature}) => feature.id === '42');
});
Optional
findFeatureFun: DataLayerFilter<Feature<Geometry, GeoJsonProperties>, any>Set the center of the current view.
// Mount Everest 27° 59′ 17″ N, 86° 55′ 31″ E
webMap.setCenter([86.925278, 27.988056]);
Array of two numbers representing longitude and latitude of the center of the map view.
Set the cursor icon to be displayed when hover icon on the map container.
Available cursor name from https://developer.mozilla.org/ru/docs/Web/CSS/cursor
Sets the GeoJSON data for given vector layer.
const layer = webMap.addLayer('GEOJSON').then((layer) => {
webMap.setLayerData(layer, geojson);
});
Set transparency for a given layer by number from 0 to 1
Sets the view of the map geographical center and zoom
// Mount Everest 27° 59′ 17″ N, 86° 55′ 31″ E
webMap.setView([86.925278, 27.988056], 12)
Optional
zoom: numberThe zoom level to set (0-24).
Zoom to a specific zoom level.
The zoom level to set (0-24).
Show added layer on the map by it definition.
Change added layer visibility on the map by given status or inverse current status.
webMap.addLayer('TILE', {id: 'my_layer', url: ''}).then((layer) => {
webMap.toggleLayer(layer, true);
webMap.toggleLayer('my_layer', false);
webMap.toggleLayer('my_layer');
webMap.isLayerVisible(layer); // true
});
Optional
status: booleanUnselect the given layer. If the adapter is a vector layer and supports data selection, you can pass a callback function to specify which data will be unselected.
const layer = webMap.addLayer('GEOJSON', {data: geojson}).then((layer) => {
webMap.unSelectLayer(layer, ({feature}) => feature.id === '42');
});
Optional
findFeatureFun: DataLayerFilter<Feature<Geometry, GeoJsonProperties>, any>Generated using TypeDoc
From runtime params