Skip to main content

@mapgear/geoapps > Map

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

PropertyModifiersTypeDescription
onLoadedreadonlyGAEvent<GAEventArgs>Triggers when the map is loaded

Properties

PropertyModifiersTypeDescription
AnalysesreadonlyAnalysesAccess the analyses for the current map
BaseLayersreadonlyBaseLayersAccess the baselayer configuration for the current map
BookmarksreadonlyBookmarksAccess the bookmark configuration for the current map
ControlsreadonlyControlsManage the controls related to the current map element
DrawingreadonlyDrawingAccess the drawing options for the current map
ExtentreadonlyExtentGet the current extent of the map
InformationOverlaysreadonlyInformationOverlaysAccess the information overlays for the current map
InteractionsreadonlyInteractionsAccess the interactions related to the current map element
LayersreadonlyLayersAccess the layers for the current map with the current activated thememap
MapEnginereadonlyMapEngineRetrieve the MapEngine-objects used within this map
MapIdreadonlystringThe current id of the active map
MeasurementsreadonlyMeasurementsEnables the user to perform measurements on the map
PermalinksreadonlyPermalinksAccess the permalinks for the current map
PrintsreadonlyPrintsAccess the printing functionality for the current map
RotationreadonlynumberGet the current rotation of the map
SearchreadonlySearchEnables the user to perform search actions on the map
ThemeMapsreadonlyThemeMapsAccess the thememaps in the currently loaded map
WorkspaceIdstringThe current id of the active workspace
ZoomLevelreadonlynumberGet the current zoom level of the map

Methods

MethodModifiersDescription
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