Add a fixed element to the content area which resides at a z-level above tiled map content. These elements do not scale with the map scale. This is used to place markers or callouts on the map
Any html that can be added to the DOM.
The x coordinate of the insertion point in map units.
The y coordinate of the insertion point in map units.
JavaScript object of the form {dragEnabled, useElementInsteadOfNewGestureOverlay, downAction, moveAction, upAction, wheelAction } where dragEnabled flags whether dragging should be enabled on the element, and downAction, moveAction, upAction, and wheelAction are callback functions invoked on mousedown, mousemove, mouseup, and scroll events respectively.
Add a styled path geometry to the content area which resides at a z-level above tiled map content. The geometry is converted to SVG and added to the content area DOM. If an attempt to add a geometry is made with the same key, the geometry is swapped out. You must remove using removePathGeometry for resource cleanup.
The styledGeometry to render.
String used to tie a geometry to its SVG
optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry.
optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry. rendering in the DOM.
SVGElement
The SVG element which was added to the DOM.
Initiates digitization on the map control. This creates a new geometry and adds verticies to the geometry accord to mouse click locations.
JavaScript object of the form { key, shapeType, geometryStyle, styledGeometry, nodeTapAndHoldAction, nodeMoveAction, shapeChangeAction, envelopeEndAction, circleEndAction, supressNodeAdd, leavePath } where key is a a string associated with this geometry, shapeType is the type of shape this geometry is, one of 'polygon', 'polyline', 'multipoint', 'envelope' or 'circle', geometryStyle is a geometryStyle which should be applied to the digitized geometry, styledGeometry is an optional styledGeometry for existing paths to edit, set this to enter edit mode, nodeTapAndHoldAction is a callback invoked when any point in the geometry is clicked and held and has the signature nodeTapAndHoldAction(setIdx, idx), nodeMoveAction is a callback invoked after any node is dragged to a new location and has signature nodeMoveAction(x, y, actionType), shapeChangeAction is a callback that is invoked after the geometry shape changes and, has signature shapeChangeAction(shape), envelopeEndAction is a callback invoked after an envelope is created and has signature envelopeEndAction(envelope), circleEndAction is similar to envelopeEndAction but takes a geometry.polygon representing the circle, and leavePath is a flag that indicates whether the digitized shape should be left on the map after digitization is complete.
Gets a point in map units from supplied coordinates pixel units with respect to the currently displayed extents.
The x coordinate in pixels.
The y coordinate in pixels.
The generated point in map units.
Programmatically delete a node from the currently digitizing path.
The index of the set from which to remove the node.
The index of the node to remove.
Animates parabolically from the current map center and zoom level to the given map center and zoom level.
Desired map center as a point.
Desired zoom level.
Gets the current actual map scale. This is the ratio of units on the screen to actual units on the earth's surface at the latitude of the current map center.
number
The ratio of screen units to actual meters.
Gets the best fit zoom level based on the supplied map extents for the current display extents in pixels.
New map extents to fit.
number
The zoom level which best fits the extents.
Gets a snapshot copy of the currently digitizing path.
The currently digitizing path.
Gets the center of the map in spherical mercator. Use sphericalMercator.deprojectToLatLon static function to convert to a lat/lon.
A point map center
Gets the current map extents in spherical mercator units.
envelope The current map extents.
Gets the current map units per pixel.
number
Map units (meters) per pixel.
Gets the current projected map scale. This is the ratio of units on the screen to map units depicted.
number
Ratio of screen units to map units.
Gets a tile layer from the display stack by its key.
The desired tile layer's key.
The tile layer associated with the key, or null if no tile layer is associated with the key.
Gets the current number of tile layers in the display stack.
number
The number of tile layers in the display stack.
Gets the map extents' width and height in pixels.
{ w: number; h: number; }
JavaScript object of the form {w, h} where w is the current extents' width in pixels and h is the current extents' height in pixels.
Gets the current zoom level.
number
The current zoom level.
Determines whether a shape is currently being digitized.
boolean
Whether or not a shape is being digitized.
Move an existing fixed content element.
The existing DOM element to move.
The new x coordinate in map units.
The new y coordinate in map units.
Offsets the current map center by the specified deltas in pixels.
Offsets the current map center by the specified deltas in pixels - animated version.
Removes the last set from the currently digitizing path.
Array<number>
The last set from the currently digitizing path in the form [xn,yn].
Removes a tile layer off the top of the display stack
The removed tile layer.
Forces additional digitized points to be pushed to a new set of the currently digitizing geometry.
Pushes a supplied tile layer onto the top of the display stack.
The desired tile layer.
Forces the map to redraw the currently loaded tile and geometry content. You should not have to call this as redraws are automatically handled during programatic state changes. This would be for edge cases where the developer is affecting internal state in an undocumented way.
Removes all tile layers off the display stack
Removes a fixed content element.
The DOM element to remove. Note: This must be the same element added by addFixedContentElement.
Removes a styledGeometry from display.
The key of the geometry to remove.
SVGElement
The SVG element which was removed from the DOM.
Removes a tile layer off the display stack by reference
A tile layer to remove.
Updates the map to the size of its container. This updates internal parameters for computing map extents and handling the amount of tile content to download. This is handled automatically if the browser window is resized. But if you are sizing the map programatically (e.g. resizable panel or slider) then call this after the parent container has resized.
Sets the background color of the map using a css color string
Sets the margin around the map in pixels for extra content fetched so that tile rebuilding of the display is minimized. This is an advanced property and does not generally need to be adjusted. The default is 128 pixels, or half the width of a tile. This should be increased for maps which are very large in pixels or where panning is constant. This should be decreased for very small maps, such as on mobile devices, or where panning is minimal.
The content extent margin in pixels.
Set the function called when map content (map tiles and fixed elements) are re-positioned in the DOM. This is done automatically as the map is panned beyond existing content and zoomed to a new level requiring content.
The function to call when the map content completes repositioning with signature action(object) where object is of the form { centerX, centerY, zoomLevel, mapUnitsPerPixel }.
Sets the z-order of drawn content in relation to the gesture capture panel. The default behavior (false) is to have fixed content and geometry underneath the gesture panel in the DOM. If false, all pointer events are handled by the gesture capture panel and optionally parents of the map control. If true, drawn content will receive pointer events first and will block gestures to the map. If true, digitizing will not function and polygons will block map navigation. In some scenarios you may want to set this to true if you are placing fixed content (such as point features) on the map and need to handle gestures on the placed content. You can call this function at any time to change the order.
Whether or not the fixed content layer should reside above the gesture layer.
Set the function called when the map extents have stopped changing (e.g. after an animated pan or zoom).
The function to call when the extents finish changing with signature action(object) where object is of the form { centerX, centerY, centerLat, centerLon, zoomLevel, mapScale, mapScaleProjected, mapUnitsPerPixel, extents }.
Sets the center of the map in spherical mercator. Use sphericalMercator.projectFromLatLon static function to convert from a lat/lon.
The map center as a point
Same as setMapCenter except will animate from current map center to the specified location
The map center as a point.
Sets the map center to the current geolocation if supported. The map is animated to the new location.
Sets the maximum zoom level for the map.
Sets the minimum zoom level for the map.
Desired minimum zoom level.
Sets function called when map is clicked or tapped.
The function to call on mouse click or tap with signature action(point).
Sets function called when the map pointer hovers over the map.
The function to call on mouse hover with signature action(point).
Flags whether or not map extent changes can occur through gestures like mouse or touch drag, mouse wheel, or pinch zoom.
Whether or not gestures should affect map extent changes.
Sets the current zoom level.
Animates the map from the current zoom level to the given zoom level.
The desired zoom level.
Updates an existing path geometry to reflect a style change.
The new geometryStyle.
The key of the geometry to receive the new style.
Changes the current zoom level.
Change to be added to the current zoom level.
Animates a change to the current zoom level.
Change to be added to the current zoom level.