Skip to main content

@mapgear/geoapps > BaseLayers

BaseLayers class

Provides access to the baselayer functionality of GeoApps. Can be accessed through the Map.BaseLayers-property.

Signature:
export declare class BaseLayers 

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the BaseLayers class.

Example

An example of the usage:

// Connect as anonymous user to a geoapps environment
geoapps.Initialize("<specified tenant>");

// Add the map to a div with element id `map`
var map = geoapps.AddMap("map", "<mapId>");

// Wait till the map loaded, before starting the baselayers
map.onLoaded.add(() => {
// Baselayers
map.BaseLayers.onLoaded.add(function () {
console.log(map.BaseLayers.items);
});

// Add baselayer
map.BaseLayers.AddBaselayer(<baseLayer>);

// Remove baselayer
map.BaseLayers.AddBaselayer(<baseLayer>);

// Activate baselayer
map.BaseLayers.AddBaselayer(<baseLayer>);

// Activate baselayer by its id
map.BaseLayers.ActivateBaseLayerById(<baseLayerId>);
});

Events

PropertyModifiersTypeDescription
onActivatedreadonlyGAEvent<BaseLayerActivatedEventArgs>Triggered when another baselayer is activated
onAddedreadonlyGAEvent<BaseLayerAddedEventArgs>Triggered when a baselayer is added to the collection
onLoadedreadonlyGAEvent<GAEventArgs>When the base layers are loaded for the specified map
onRemovedreadonlyGAEvent<BaseLayerRemovedEventArgs>Triggered when a baselayer is removed from the collection

Properties

PropertyModifiersTypeDescription
activeBaselayerBaseLayerThe currently active baselayer
ItemsreadonlyBaseLayer[]List the available baselayers

Methods

MethodModifiersDescription
ActivateBaseLayer(baseLayer)Activate the specified baselayer
ActivateBaseLayerById(baseLayerId)Activate the specified baselayer by the baselayer id
AddBaselayer(baseLayer)Add a new baselayer to the map
on(event, eventHandler)Bind to an event (legacy purposes)
RemoveBaseLayer(baseLayer)Remove a baselayer from the map