Layers class
Provides access to the layer tree of the current GeoApps map. Can be accessed through the Map.Layers-property.
export declare class Layers
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 Layers 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 layers
map.onLoaded.add(() => {
// Layers
console.log(map.Layers.Items);
// Add layer
map.Layers.AddLayer(<layer>);
// Create layer
map.Layers.CreateLayer(<options>);
// Enable Extended Popup Info
map.Layers.EnableExtendedPopupInfo(<layerIds>, <enabled>);
// Get layer by layer item id
map.Layers.GetLayerById(<layerItemId>);
// Get queryable layers
map.Layers.GetQueryableLayers();
// Set the popups on layer to disabled
map.Layers.SetPopupsDisabled(<bool>)
});
Events
| Property | Modifiers | Type | Description |
|---|---|---|---|
| onClicked | readonly | GAEvent<LayerClickedEventArgs> | Triggers when the map is clicked and a response is available |
| onLoaded | readonly | GAEvent<GAEventArgs> | Triggers when the layers are loaded for the current thememap |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| Items | readonly | LayerItem[] | Get all layer items in the map |
Methods
| Method | Modifiers | Description |
|---|---|---|
| AddLayer(layer) | Add a layer to the map | |
| CreateLayer(options) | Construct a new layer object | |
| EnableExtendedPopupInfo(layerIds, enabled) | Determines if the standard popup data is retrieved, or that additionaly the data is retrieved as popup info | |
| GetLayerById(layerItemId) | Retrieve a layer by the specified id | |
| GetQueryableLayers() | Retrieves layer items that are queryable | |
| Initialize(mapEngine) | Perform initialization when mapEngine is loaded | |
| on(event, eventHandler) | Bind to an event (legacy purposes) | |
| SetPopupsDisabled(bool) | Determines if popups are disabled (clicking in the map to retrieve popups) |