BaseLayers class
Provides access to the baselayer functionality of GeoApps. Can be accessed through the Map.BaseLayers
-property.
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
Property | Modifiers | Type | Description |
---|---|---|---|
onActivated | readonly | GAEvent<BaseLayerActivatedEventArgs> | Triggered when another baselayer is activated |
onAdded | readonly | GAEvent<BaseLayerAddedEventArgs> | Triggered when a baselayer is added to the collection |
onLoaded | readonly | GAEvent<GAEventArgs> | When the base layers are loaded for the specified map |
onRemoved | readonly | GAEvent<BaseLayerRemovedEventArgs> | Triggered when a baselayer is removed from the collection |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
activeBaselayer | BaseLayer | The currently active baselayer | |
Items | readonly | BaseLayer[] | List the available baselayers |
Methods
Method | Modifiers | Description |
---|---|---|
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 |