Class Map

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(id: HTMLElement, options?: MapOptions): Map

Constructor: OpenLayers.Map Constructor for a new OpenLayers.Map instance. There are two possible ways to call the map constructor. See the examples below.

Parameters: div - {DOMElement|String} The element or id of an element in your page that will contain the map. May be omitted if the

option is provided or if you intend to call the method later. options - {Object} Optional object with properties to tag onto the map.

Valid options (in addition to the listed API properties): center - {|Array} The default initial center of the map. If provided as array, the first value is the x coordinate, and the 2nd value is the y coordinate. Only specify if is provided. Note that if an ArgParser/Permalink control is present, and the querystring contains coordinates, center will be set by that, and this option will be ignored. zoom - {Number} The initial zoom level for the map. Only specify if

is provided. Note that if an ArgParser/Permalink control is present, and the querystring contains a zoom level, zoom will be set by that, and this option will be ignored.

Examples: (code) // create a map with default options in an element with the id "map1" var map = new OpenLayers.Map("map1");

// create a map with non-default options in an element with id "map2" var options = { projection: "EPSG:3857", maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000), center: new OpenLayers.LonLat(-12356463.476333, 5621521.4854095) }; var map = new OpenLayers.Map("map2", options);

// map with non-default options - same as above but with a single argument, // a restricted extent, and using arrays for bounds and center var map = new OpenLayers.Map({ div: "map_id", projection: "EPSG:3857", maxExtent: [-18924313.432222, -15538711.094146, 18924313.432222, 15538711.094146], restrictedExtent: [-13358338.893333, -9608371.5085962, 13358338.893333, 9608371.5085962], center: [-12356463.476333, 5621521.4854095] });

// create a map without a reference to a container - call render later var map = new OpenLayers.Map({ projection: "EPSG:3857", maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000) }); (end)

Parameters

Returns

Map

constructor(id: string, options?: MapOptions): Map

Parameters

Returns

Map

Properties

public static TILE_HEIGHT: string

public static TILE_WIDTH: string

public allOverlays: boolean

Allow the map to function with "overlays" only. Defaults to false. If true, the lowest layer in the draw order will act as the base layer. In addition, if set to true, all layers will have isBaseLayer set to false when they are added to the map.

public autoUpdateSize: boolean

APIProperty: autoUpdateSize {Boolean} Should OpenLayers automatically update the size of the map when the resize event is fired. Default is true.

public baseLayer: Layer

The currently selected base layer. This determines min/max zoom level, projection, etc.

public center: LonLat

The current center of the map

public controls: Control[]

List of controls associated with the map.

public displayProjection: Projection

APIProperty: displayProjection {} Requires proj4js support for projections other than EPSG:4326 or EPSG:900913/EPSG:3857. Projection used by several controls to display data to user. If this property is set, it will be set on any control which has a null displayProjection property at the time the control is added to the map.

public div: Object

The element that contains the map (or an id for that element).

public dragging: boolean

The map is currently being dragged.

public eventListeners: Object

APIProperty: eventListeners {Object} If set as an option at construction, the eventListeners object will be registered with . Object structure must be a listeners object as shown in the example for the events.on method.

public events: Events

An events object that handles all events on the map

public fallThrough: boolean

APIProperty: fallThrough {Boolean} Should OpenLayers allow events on the map to fall through to other elements on the page, or should it swallow them? (#457) Default is to swallow.

public fractionalZoom: boolean

For a base layer that supports it, allow the map resolution to be set to a value between one of the values in the resolutions array. Default is false.

public id: string

Unique identifier for the map

public layerContainerDiv: HTMLDivElement

The element that contains the layers.

public layerContainerOrigin: LonLat

The lonlat at which the later container was re-initialized (on-zoom)

public layerContainerOriginPx: Object

Property: layerContainerOriginPx {Object} Cached object representing the layer container origin (in pixels).

public layers: Layer[]

Ordered list of layers in the map

public maxExtent: Bounds

APIProperty: maxExtent {|Array} If provided as an array, the array should consist of four values (left, bottom, right, top). The maximum extent for the map. Default depends on projection; if this is one of those defined in OpenLayers.Projection.defaults (EPSG:4326 or web mercator), maxExtent will be set to the value defined there; else, defaults to null. To restrict user panning and zooming of the map, use instead. The value for will change calculations for tile URLs.

public maxPx: { x: number; y: number; }

Property: maxPx {Object} An object with a 'x' and 'y' values that is the top right of maxExtent in viewport pixel space. Used to verify in moveByPx that the new location we're moving to is valid.

public maxPx.x: number

public maxPx.y: number

public maxResolution: number

Required if you are not displaying the whole world on a tile with the size specified in .

public maxScale: number

APIProperty: maxScale {Float}

public minExtent: Bounds

APIProperty: minExtent {|Array} If provided as an array, the array should consist of four values (left, bottom, right, top). The minimum extent for the map. Defaults to null.

public minPx: { x: number; y: number; }

Property: minPx {Object} An object with a 'x' and 'y' values that is the lower left of maxExtent in viewport pixel space. Used to verify in moveByPx that the new location we're moving to is valid. It is also used in the getLonLatFromViewPortPx function of Layer.

public minPx.x: number

public minPx.y: number

public minResolution: number

APIProperty: minResolution {Float}

public minScale: number

APIProperty: minScale {Float}

public numZoomLevels: number

APIProperty: numZoomLevels {Integer} Number of zoom levels for the map. Defaults to 16. Set a different value in the map options if needed.

public options: Object

The options object passed to the class constructor. Read-only.

public paddingForPopups: Bounds

Property: paddingForPopups {} Outside margin of the popup. Used to prevent the popup from getting too close to the map border.

public panDuration: number

Property: panDuration {Integer} The number of steps to be passed to the OpenLayers.Tween.start() method when the map is panned. Default is 50.

public panMethod: () => void

APIProperty: panMethod {Function} The Easing function to be used for tweening. Default is OpenLayers.Easing.Expo.easeOut. Setting this to 'null' turns off animated panning.

public panRatio: number

The ratio of the current extent within which panning will tween.

public panTween: Tween

Property: panTween {} Animated panning tween object, see panTo()

public popups: Popup[]

List of popups associated with the map

public projection: string

Set in the map options to specify the default projection for layers added to this map. When using a projection other than EPSG:4326 (CRS:84, Geographic) or EPSG:3857 (EPSG:900913, Web Mercator), also set maxExtent, maxResolution or resolutions. Default is "EPSG:4326". Note that the projection of the map is usually determined by that of the current baseLayer (see and ).

public resolution: number

The resolution of the map.

public resolutions: Array<number>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public restrictedExtent: Bounds

APIProperty: restrictedExtent Limit map navigation to this extent where possible. If a non-null restrictedExtent is set, panning will be restricted to the given bounds. In addition, zooming to a resolution that displays more than the restricted extent will center the map on the restricted extent. If you wish to limit the zoom level or resolution, use maxResolution.

public size: Size

Size of the main div (this.div)

public theme: string

APIProperty: theme {String} Relative path to a CSS file from which to load theme styles. Specify null in the map options (e.g. {theme: null}) if you want to get cascading style declarations - by putting links to stylesheets or style declarations directly in your page.

public tileSize: Size

Set in the map options to override the default tile size for this map.

public units: string

The map units. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units

private updateSizeDestroy: () => void

Method: updateSizeDestroy When the map is destroyed, we need to stop listening to updateSize events: this method stores the function we need to unregister in non-IE browsers.

public viewPortDiv: HTMLDivElement

The element that represents the map viewport

public zoom: number

The current zoom level of the map

public zoomDuration: number

Property: zoomDuration {Integer} The number of steps to be passed to the OpenLayers.Tween.start() method when the map is zoomed. Default is 20.

public zoomMethod: () => void

APIProperty: zoomMethod {Function} The Easing function to be used for tweening. Default is OpenLayers.Easing.Quad.easeOut. Setting this to 'null' turns off animated zooming.

public zoomTween: Tween

Property: zoomTween {} Animated zooming tween object, see zoomTo()

Methods

public addControl(control: Control, px: Pixel)

APIMethod: addControl Add the passed over control to the map. Optionally position the control at the given pixel.

Parameters: control - {} px - {}

Parameters

private addControlToMap(control: Control, px: Pixel)

Method: addControlToMap

Parameters:

control - {} px - {}

Parameters

public addControls(controls: Control[], pixels: Pixel[])

APIMethod: addControls Add all of the passed over controls to the map. You can pass over an optional second array with pixel-objects to position the controls. The indices of the two arrays should match and you can add null as pixel for those controls you want to be autopositioned.

Parameters: controls - {Array()} pixels - {Array()}

Parameters

public addLayer(layer: Layer): boolean

APIMethod: addLayer

Parameters: layer - {}

Returns: {Boolean} True if the layer has been added to the map.

Parameters

Returns

boolean

public addLayers(layers: Layer[])

APIMethod: addLayers

Parameters: layers - {Array()}

Parameters

public addPopup(popup: Popup, exclusive: boolean)

APIMethod: addPopup

Parameters: popup - {} exclusive - {Boolean} If true, closes all other popups first

Parameters

  • popup: Popup
  • exclusive: boolean

public calculateBounds(center?: LonLat, resolution?: number): Bounds

Method: calculateBounds

Parameters: center - {} Default is this.getCenter() resolution - {float} Default is this.getResolution()

Returns: {} A bounds based on resolution, center, and current mapsize.

Parameters

  • center?: LonLat optional
  • resolution?: number optional

Returns

Bounds

public destroy()

APIMethod: destroy Destroy this map. Note that if you are using an application which removes a container of the map from the DOM, you need to ensure that you destroy the map before this happens; otherwise, the page unload handler will fail because the DOM elements that map.destroy() wants to clean up will be gone. (See http://trac.osgeo.org/openlayers/ticket/2277 for more information). This will apply to GeoExt and also to other applications which modify the DOM of the container of the OpenLayers Map.

public getBy(array: string, property: string, match: string): Array<any>

APIMethod: getBy Get a list of objects given a property and a match item.

Parameters: array - {String} A property on the map whose value is an array. property - {String} A property on each item of the given array. match - {String | Object} A string to match. Can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if match.test(map[array][i][property]) evaluates to true, the item will be included in the array returned. If no items are found, an empty array is returned.

Returns: {Array} An array of items where the given property matches the given criteria.

Parameters

  • array: string
  • property: string
  • match: string

Returns

Array<any>

public getBy(array: string, property: string, match: Object): Array<any>

Parameters

  • array: string
  • property: string
  • match: Object

Returns

Array<any>

public getCenter(): LonLat

APIMethod: getCenter

Returns: {}

Returns

LonLat

public getControl(id: string): Control

APIMethod: getControl

Parameters: id - {String} ID of the control to return.

Returns: {} The control from the map's list of controls which has a matching 'id'. If none found, returns null.

Parameters

  • id: string

Returns

Control

public getControlsBy(property: string, match: string): Control[]

APIMethod: getControlsBy Get a list of controls with properties matching the given criteria.

Parameters: property - {String} A control property to be matched. match - {String | Object} A string to match. Can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if match.test(layer[property]) evaluates to true, the layer will be included in the array returned. If no layers are found, an empty array is returned.

Returns: {Array()} A list of controls matching the given criteria. An empty array is returned if no matches are found.

Parameters

  • property: string
  • match: string

Returns

Control[]

public getControlsBy(property: string, match: Object): Control[]

Parameters

  • property: string
  • match: Object

Returns

Control[]

public getControlsByClass(match: string): Control[]

APIMethod: getControlsByClass Get a list of controls of a given class (CLASS_NAME).

Parameters: match - {String | Object} A control class name. The match can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if type.test(control.CLASS_NAME) evaluates to true, the control will be included in the list of controls returned. If no controls are found, an empty array is returned.

Returns: {Array()} A list of controls matching the given class. An empty array is returned if no matches are found.

Parameters

  • match: string

Returns

Control[]

public getControlsByClass(match: Object): Control[]

Parameters

  • match: Object

Returns

Control[]

private getCurrentSize(): Size

Method: getCurrentSize

Returns: {} A new object with the dimensions of the map div

Returns

Size

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort. If no baselayer is set, returns null.

Returns

Bounds

public getLayer(id: string): Layer

APIMethod: getLayer Get a layer based on its id

Parameters: id - {String} A layer id

Returns: {} The Layer with the corresponding id from the map's layer collection, or null if not found.

Parameters

  • id: string

Returns

Layer

public getLayerIndex(layer: Layer): number

APIMethod: getLayerIndex

Parameters: layer - {}

Returns: {Integer} The current (zero-based) index of the given layer in the map's layer stack. Returns -1 if the layer isn't on the map.

Parameters

Returns

number

public getLayerPxFromLonLat(lonlat: LonLat): Pixel

APIMethod: getLayerPxFromLonLat

Parameters: lonlat - {} lonlat

Returns: {} An OpenLayers.Pixel which is the passed-in

, translated into layer pixels by the current base layer

Parameters

Returns

Pixel

public getLayerPxFromViewPortPx(viewPortPx: Pixel): Pixel

APIMethod: getLayerPxFromViewPortPx

Parameters: viewPortPx - {}

Returns: {} ViewPort Pixel translated into Layer Pixel coordinates

Parameters

Returns

Pixel

public getLayersBy(property: string, match: string): Layer[]

APIMethod: getLayersBy Get a list of layers with properties matching the given criteria.

Parameters: property - {String} A layer property to be matched. match - {String | Object} A string to match. Can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if match.test(layer[property]) evaluates to true, the layer will be included in the array returned. If no layers are found, an empty array is returned.

Returns: {Array()} A list of layers matching the given criteria. An empty array is returned if no matches are found.

Parameters

  • property: string
  • match: string

Returns

Layer[]

public getLayersBy(property: string, match: Object): Layer[]

Parameters

  • property: string
  • match: Object

Returns

Layer[]

public getLayersByClass(match: string): Layer[]

APIMethod: getLayersByClass Get a list of layers of a given class (CLASS_NAME).

Parameters: match - {String | Object} A layer class name. The match can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if type.test(layer.CLASS_NAME) evaluates to true, the layer will be included in the list of layers returned. If no layers are found, an empty array is returned.

Returns: {Array()} A list of layers matching the given class. An empty array is returned if no matches are found.

Parameters

  • match: string

Returns

Layer[]

public getLayersByClass(match: Object): Layer[]

Parameters

  • match: Object

Returns

Layer[]

public getLayersByName(match: string): Layer[]

APIMethod: getLayersByName Get a list of layers with names matching the given name.

Parameters: match - {String | Object} A layer name. The name can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if name.test(layer.name) evaluates to true, the layer will be included in the list of layers returned. If no layers are found, an empty array is returned.

Returns: {Array()} A list of layers matching the given name. An empty array is returned if no matches are found.

Parameters

  • match: string

Returns

Layer[]

public getLayersByName(match: Object): Layer[]

Parameters

  • match: Object

Returns

Layer[]

public getLonLatFromPixel(px: Pixel): LonLat

APIMethod: getLonLatFromPixel

Parameters: px - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat corresponding to the given OpenLayers.Pixel, translated into lon/lat by the current base layer

Parameters

Returns

LonLat

public getLonLatFromPixel(px: { x: number; y: number; }): LonLat

Parameters

  • px: { x: number; y: number; }

Returns

LonLat

public getMaxExtent(options: { restricted: boolean; }): Bounds

APIMethod: getMaxExtent

Parameters: options - {Object}

Allowed Options: restricted - {Boolean} If true, returns restricted extent (if it is available.)

Returns: {} The maxExtent property as set on the current baselayer, unless the 'restricted' option is set, in which case the 'restrictedExtent' option from the map is returned (if it is set).

Parameters

  • options: { restricted: boolean; }

Returns

Bounds

public getMaxResolution(): string

APIMethod: getMaxResolution

Returns: {String} The Map's Maximum Resolution

Returns

string

public getMinZoom(): number

APIMethod: getMinZoom Returns the minimum zoom level for the current map view. If the base layer is configured with set to true, this will be the first zoom level that shows no more than one world width in the current map viewport. Components that rely on this value (e.g. zoom sliders) should also listen to the map's "updatesize" event and call this method in the "updatesize" listener.

Returns: {Number} Minimum zoom level that shows a map not wider than its

's maxExtent. This is an Integer value, unless the map is configured with set to true.

Returns

number

public getNumLayers(): number

APIMethod: getNumLayers

Returns: {Int} The number of layers attached to the map.

Returns

number

public getNumZoomLevels(): number

APIMethod: getNumZoomLevels

Returns: {Integer} The total number of zoom levels that can be displayed by the current baseLayer.

Returns

number

public getPixelFromLonLat(lonlat: LonLat): Pixel

APIMethod: getPixelFromLonLat Returns a pixel location given a map location. The map location is translated to an integer pixel location (in viewport pixel coordinates) by the current base layer.

Parameters: lonlat - {} A map location.

Returns: {} An OpenLayers.Pixel corresponding to the

translated into view port pixels by the current base layer.

Parameters

Returns

Pixel

public getProjection(): string

APIMethod: getProjection This method returns a string representing the projection. In the case of projection support, this will be the srsCode which is loaded -- otherwise it will simply be the string value that was passed to the projection at startup.

Returns: {String} The Projection string from the base layer or null.

Returns

string

public getProjectionObject(): Projection

APIMethod: getProjectionObject Returns the projection obect from the baselayer.

Returns: {} The Projection of the base layer.

Returns

Projection

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The current resolution of the map. If no baselayer is set, returns null.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom. If no baselayer is set, returns null.

Parameters

  • zoom: number

Returns

number

public getScale(): number

APIMethod: getScale

Returns: {Float} The current scale denominator of the map. If no baselayer is set, returns null.

Returns

number

public getSize(): Size

APIMethod: getSize

Returns: {} An object that represents the size, in pixels, of the div into which OpenLayers has been loaded. Note - A clone() of this locally cached variable is returned, so as not to allow users to modify it.

Returns

Size

public getTileSize(): Size

APIMethod: getTileSize Get the tile size for the map

Returns: {}

Returns

Size

public getUnits(): number

APIMethod: getUnits

Returns: {Float} The current units of the map. If no baselayer is set, returns null.

Returns

number

public getViewPortPxFromLayerPx(layerPx: Pixel): Pixel

APIMethod: getViewPortPxFromLayerPx

Parameters: layerPx - {}

Returns: {} Layer Pixel translated into ViewPort Pixel coordinates

Parameters

Returns

Pixel

public getViewPortPxFromLonLat(lonlat: LonLat): Pixel

APIMethod: getViewPortPxFromLonLat

Parameters: lonlat - {}

Returns: {} An OpenLayers.Pixel which is the passed-in

, translated into view port pixels by the current base layer.

Parameters

Returns

Pixel

public getViewport(): HTMLElement

APIMethod: getViewport Get the DOMElement representing the view port.

Returns: {DOMElement}

Returns

HTMLElement

public getZoom(): number

APIMethod: getZoom

Returns: {Integer}

Returns

number

public getZoomForExtent(bounds: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: bounds - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} A suitable zoom level for the specified bounds. If no baselayer is set, returns null.

Parameters

  • bounds: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} A suitable zoom level for the specified resolution. If no baselayer is set, returns null.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

public pan(dx: number, dy: number, options?: { animate?: boolean; dragging?: boolean; })

APIMethod: pan Allows user to pan by a value of screen pixels

Parameters: dx - {Integer} dy - {Integer} options - {Object} Options to configure panning:

  • animate {Boolean} Use panTo instead of setCenter. Default is true.
  • dragging {Boolean} Call setCenter with dragging true. Default is false.

Parameters

  • dx: number
  • dy: number
  • options?: { animate?: boolean; dragging?: boolean; } optional

public panTo(lonlat: LonLat)

APIMethod: panTo Allows user to pan to a new lonlat If the new lonlat is in the current extent the map will slide smoothly

Parameters: lonlat - {}

Parameters

public raiseLayer(layer: Layer, delta: number)

APIMethod: raiseLayer Change the index of the given layer by delta. If delta is positive, the layer is moved up the map's layer stack; if delta is negative, the layer is moved down. Again, note that this cannot (or at least should not) be effectively used to raise base layers above overlays.

Paremeters: layer - {} delta - {int}

Parameters

  • layer: Layer
  • delta: number

public removeControl(control: Control)

APIMethod: removeControl Remove a control from the map. Removes the control both from the map object's internal array of controls, as well as from the map's viewPort (assuming the control was not added outsideViewport)

Parameters: control - {} The control to remove.

Parameters

public removeLayer(layer: Layer, setNewBaseLayer?: boolean)

APIMethod: removeLayer Removes a layer from the map by removing its visual element (the layer.div property), then removing it from the map's internal list of layers, setting the layer's map property to null.

a "removelayer" event is triggered.

very worthy of mention is that simply removing a layer from a map will not cause the removal of any popups which may have been created by the layer. this is due to the fact that it was decided at some point that popups would not belong to layers. thus there is no way for us to know here to which layer the popup belongs.

A simple solution to this is simply to call destroy() on the layer. the default OpenLayers.Layer class's destroy() function automatically takes care to remove itself from whatever map it has been attached to.

The correct solution is for the layer itself to register an event-handler on "removelayer" and when it is called, if it recognizes itself as the layer being removed, then it cycles through its own personal list of popups, removing them from the map.

Parameters: layer - {} setNewBaseLayer - {Boolean} Default is true

Parameters

  • layer: Layer
  • setNewBaseLayer?: boolean optional

public removePopup(popup: Popup)

APIMethod: removePopup

Parameters: popup - {}

Parameters

public render(div: string)

APIMethod: render Render the map to a specified container.

Parameters: div - {String|DOMElement} The container that the map should be rendered to. If different than the current container, the map viewport will be moved from the current to the new container.

Parameters

  • div: string

public render(div: HTMLElement)

Parameters

  • div: HTMLElement

private resetLayersZIndex()

Method: resetLayersZIndex Reset each layer's z-index based on layer's array index

public setBaseLayer(newBaseLayer: Layer)

APIMethod: setBaseLayer Allows user to specify one of the currently-loaded layers as the Map's new base layer.

Parameters: newBaseLayer - {}

Parameters

public setCenter(lonlat: LonLat, zoom?: number, dragging?: boolean, forceZoomChange?: boolean)

APIMethod: setCenter Set the map center (and optionally, the zoom level).

Parameters: lonlat - {|Array} The new center location. If provided as array, the first value is the x coordinate, and the 2nd value is the y coordinate. zoom - {Integer} Optional zoom level. dragging - {Boolean} Specifies whether or not to trigger movestart/end events forceZoomChange - {Boolean} Specifies whether or not to trigger zoom change events (needed on baseLayer change)

Parameters

  • lonlat: LonLat
  • zoom?: number optional
  • dragging?: boolean optional
  • forceZoomChange?: boolean optional

public setCenter(lonlat: Array<number>, zoom?: number, dragging?: boolean, forceZoomChange?: boolean)

Parameters

  • lonlat: Array<number>
  • zoom?: number optional
  • dragging?: boolean optional
  • forceZoomChange?: boolean optional

public setLayerIndex(layer: Layer, idx: number)

APIMethod: setLayerIndex Move the given layer to the specified (zero-based) index in the layer list, changing its z-index in the map display. Use map.getLayerIndex() to find out the current index of a layer. Note that this cannot (or at least should not) be effectively used to raise base layers above overlays.

Parameters: layer - {} idx - {int}

Parameters

  • layer: Layer
  • idx: number

private setLayerZIndex(layer: Layer, zIdx: number)

Method: setLayerZIndex

Parameters: layer - {} zIdx - {int}

Parameters

  • layer: Layer
  • zIdx: number

public setOptions(options: {})

APIMethod: setOptions Change the map options

Parameters: options - {Object} Hashtable of options to tag to the map

Parameters

  • options: {}

private unloadDestroy(): () => void

Method: unloadDestroy Function that is called to destroy the map on page unload. stored here so that if map is manually destroyed, we can unregister this.

Returns

() => void

public updateSize()

APIMethod: updateSize This function should be called by any external code which dynamically changes the size of the map div (because mozilla wont let us catch the "onresize" for an element)

public zoomIn()

APIMethod: zoomIn

public zoomOut()

APIMethod: zoomOut

public zoomTo(zoom: number, px: Pixel)

APIMethod: zoomTo Zoom to a specific zoom level. Zooming will be animated unless the map is configured with {zoomMethod: null}. To zoom without animation, use

without a lonlat argument.

Parameters: zoom - {Integer}

Parameters

public zoomToExtent(bounds: Bounds, closest?: boolean)

APIMethod: zoomToExtent Zoom to the passed in bounds, recenter

Parameters: bounds - {|Array} If provided as an array, the array should consist of four values (left, bottom, right, top). closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Parameters

  • bounds: Bounds
  • closest?: boolean optional

public zoomToExtent(bounds: Array<number>, closest?: boolean)

Parameters

  • bounds: Array<number>
  • closest?: boolean optional

public zoomToMaxExtent(options?: { restricted: boolean; })

APIMethod: zoomToMaxExtent Zoom to the full extent and recenter.

Parameters: options - {Object}

Allowed Options: restricted - {Boolean} True to zoom to restricted extent if it is set. Defaults to true.

Parameters

  • options?: { restricted: boolean; } optional

public zoomToScale(scale: number, closest: boolean)

APIMethod: zoomToScale Zoom to a specified scale

Parameters: scale - {float} closest - {Boolean} Find the zoom level that most closely fits the specified scale. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Parameters

  • scale: number
  • closest: boolean