Map class
Provides access to the map that is initialized in the UI. The properties provide access to manipulation of the map.
Signature:export declare class Map
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 Map
class.
Example
The following example shows how to retrieve a Map
:
// 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 and get the title
map.onLoaded.add(() => {
console.log(map.Properties.Title);
});
Events
Property | Modifiers | Type | Description |
---|---|---|---|
onLoaded | readonly | GAEvent<GAEventArgs> | Triggers when the map is loaded |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
Analyses | readonly | Analyses | Access the analyses for the current map |
BaseLayers | readonly | BaseLayers | Access the baselayer configuration for the current map |
Bookmarks | readonly | Bookmarks | Access the bookmark configuration for the current map |
Controls | readonly | Controls | Manage the controls related to the current map element |
Drawing | readonly | Drawing | Access the drawing options for the current map |
Extent | readonly | Extent | Get the current extent of the map |
InformationOverlays | readonly | InformationOverlays | Access the information overlays for the current map |
Interactions | readonly | Interactions | Access the interactions related to the current map element |
Layers | readonly | Layers | Access the layers for the current map with the current activated thememap |
MapEngine | readonly | MapEngine | Retrieve the MapEngine-objects used within this map |
MapId | readonly | string | The current id of the active map |
Measurements | readonly | Measurements | Enables the user to perform measurements on the map |
Permalinks | readonly | Permalinks | Access the permalinks for the current map |
Prints | readonly | Prints | Access the printing functionality for the current map |
Rotation | readonly | number | Get the current rotation of the map |
Search | readonly | Search | Enables the user to perform search actions on the map |
ThemeMaps | readonly | ThemeMaps | Access the thememaps in the currently loaded map |
WorkspaceId | string | The current id of the active workspace | |
ZoomLevel | readonly | number | Get the current zoom level of the map |
Methods
Method | Modifiers | Description |
---|---|---|
AddOverlay(overlay, position) | Add an overlay to the map at the specified position | |
CreateOverlay(element, options) | Create an overlay object from a specified DOM-element | |
GetInternalMapObject() | Retrieves the internal map engine object, currently OpenLayers. Usage of this object is allowed, but not supported | |
on(event, eventHandler) | Bind to an event (legacy purposes) | |
RemoveOverlay(overlay) | Remove an overlay from the map | |
ResetRotation() | Reset the rotation of the map to the initial (home) value | |
SetHomePosition(location) | Modify the home position of the map in the current session. Update to this home position is not preserved in the map configuration in GeoApps | |
SetRotation(rotation) | Set the map at a specified rotation | |
SetZoomLevel(zoomLevel) | Set the map at a specified zoom level | |
UpdateSize() | Trigger a recalculation of the map extent, for instance after automated size change of the containing DOM-element | |
ZoomIn() | Zoom in to the map by 1 step | |
ZoomOut() | Zoom out of the map by 1 step | |
ZoomTo(location) | Zoom, rotate and move the map to the specified location | |
ZoomToCurrentGeolocation() | Zooms to current geolocation | |
ZoomToExtent(extent) | Zoom the map to the specified extent | |
ZoomToGeometry(geometry, options) | Zoom the map to the specified geometry | |
ZoomToHome() | Zoom, rotate and move the map to the home location specified in GeoApps |