OpenLayers.Map

Instances of OpenLayers.Map are interactive maps embedded in a web page.  Create a new map with the OpenLayers.Map constructor.

Summary
Instances of OpenLayers.Map are interactive maps embedded in a web page.
{Integer} 256
{Integer} 256
{Object} Base z-indexes for different classes of thing
{Array} supported application event types
{String} Unique identifier for the map
{<OpenLayers.Events>} An events object that handles all events on the map
Function that is called to destroy the map on page unload.
{DOMElement} The element that contains the map
{OpenLayers.Size} Size of the main div (this.div)
{HTMLDivElement} The element that represents the map viewport
{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom)
{HTMLDivElement} The element that contains the layers.
{Array(OpenLayers.Layer)} Ordered list of layers in the map
{Array(<OpenLayers.Control>)} List of controls associated with the map
{Array(<OpenLayers.Popup>)} List of popups associated with the map
{OpenLayers.LonLat} The current center of the map
{Integer} The current zoom level of the map
{String} Used to store a unique identifier that changes when the map view changes.
{OpenLayers.Size} Set in the map options to override the default tile size for this map.
{String} Set in the map options to override the default projection string this map - also set maxExtent, maxResolution, and units if appropriate.
{String} The map units.
{Number} Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps.
{Number}
{Number}
{OpenLayers.Bounds} The maximum extent for the map.
{Integer} Number of zoom levels for the map.
{String} Relative path to a CSS file from which to load theme styles.
{Boolean} Should OpenLayers allow events on the map to fall through to other elements on the page, or should it swallow them? 
Constructor for a new OpenLayers.Map instance.
Destroy this map
Change the map options
Get the tile size for the map
Get a layer based on its id
{String} OpenLayers.Map

Constants

TILE_WIDTH

{Integer} 256

TILE_HEIGHT

{Integer} 256

Z_INDEX_BASE

{Object} Base z-indexes for different classes of thing

EVENT_TYPES

{Array} supported application event types

Properties and Functions

id

{String} Unique identifier for the map

events

{<OpenLayers.Events>} An events object that handles all events on the map

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.

div

{DOMElement} The element that contains the map

size

{OpenLayers.Size} Size of the main div (this.div)

viewPortDiv

{HTMLDivElement} The element that represents the map viewport

layerContainerOrigin

{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom)

layerContainerDiv

{HTMLDivElement} The element that contains the layers.

layers

{Array(OpenLayers.Layer)} Ordered list of layers in the map

controls

{Array(<OpenLayers.Control>)} List of controls associated with the map

popups

{Array(<OpenLayers.Popup>)} List of popups associated with the map

baseLayer

{<OpenLayers.Layer>} The currently selected base layerthis determines min/max zoom level, projection, etc.

center

{OpenLayers.LonLat} The current center of the map

zoom

{Integer} The current zoom level of the map

viewRequestID

{String} Used to store a unique identifier that changes when the map view changes. viewRequestID should be used when adding data asynchronously to the map: viewRequestID is incremented when you initiate your request (right now during changing of baselayers and changing of zooms).  It is stored here in the map and also in the data that will be coming back asynchronously.  Before displaying this data on request completion, we check that the viewRequestID of the data is still the same as that of the map.  Fix for #480

tileSize

{OpenLayers.Size} Set in the map options to override the default tile size for this map.

projection

{String} Set in the map options to override the default projection string this map - also set maxExtent, maxResolution, and units if appropriate.

units

{String} The map units.  Defaults to ‘degrees’.  Possible values are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’.

maxResolution

{Number} Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps.  Specify a different value in the map options if you are not using a geographic projection and displaying the whole world.

minResolution

{Number}

maxScale

{Number}

minScale

maxExtent

{OpenLayers.Bounds} The maximum extent for the map.  Defaults to the whole world in decimal degrees (-180, -90, 180, 90).  Specify a different extent in the map options if you are not using a geographic projection and displaying the whole world.

numZoomLevels

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

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.

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 them.

OpenLayers.Map

Constructor for a new OpenLayers.Map instance.

Parameters

div{String} The id of an element in your page that will contain the map
options{Object} An optional object with properties to tag onto the map

Examples

// 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 = {
maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000),
maxResolution: 156543,
units: 'meters',
projection: "EPSG:41001"
};
var map = new OpenLayers.Map("map2", options);

Return

A new OpenLayers.Map instance

destroy

destroy:function()

Destroy this map

setOptions

setOptions: function(options)

Change the map options

Parameters

options{Object} Hashtable of options to tag to the map

getTileSize

getTileSize: function()

Get the tile size for the map

Return

{OpenLayers.Size}

getLayer

getLayer: function(id)

Get a layer based on its id

Parameter

id{String} A layer id

Return

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

Constants

CLASS_NAME

{String} OpenLayers.Map

Instances of this class represent a width/height pair
This class represents a longitude and latitude pair
Instances of this class represent bounding boxes.
destroy:function()
Destroy this map
setOptions: function(options)
Change the map options
getTileSize: function()
Get the tile size for the map
getLayer: function(id)
Get a layer based on its id
Constructor for a new OpenLayers.Map instance.