OpenLayers JavaScript Mapping Library OpenLayers Map |
OpenLayers.MapInstances of OpenLayers.Map are interactive maps embedded in a web page. Create a new map with the OpenLayers.Map constructor. Summary
events{OpenLayers.Events} An events object that handles all events on the map size{OpenLayers.Size} Size of the main div (this.div) layerContainerOrigin{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom) 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 center{OpenLayers.LonLat} The current center 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. 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. OpenLayers.MapConstructor for a new OpenLayers.Map instance. Parameters
Examples// create a map with default options in an element with the id "map1" ReturnA new OpenLayers.Map instance getLayer
Get a layer based on its id Parameter
Return{OpenLayers.Layer} The Layer with the corresponding id from the map’s layer collection, or null if not found. 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
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
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
|
Destroy this map
destroy:function()
Change the map options
setOptions: function( options )
Get the tile size for the map
getTileSize: function()
Get a layer based on its id
getLayer: function( id )
Private.
setLayerZIndex: function ( layer, zIdx )
addLayer: function ( layer )
addLayers: function ( layers )
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.
removeLayer: function( layer, setNewBaseLayer )
Return: {Int} The number of layers attached to the map.
getNumLayers: function ()
@param {OpenLayers.Layer} layer
getLayerIndex: function ( layer )
Move the given layer to the specified (zero-based) index in the layer list, changing its z-index in the map display.
setLayerIndex: function ( layer, idx )
Change the index of the given layer by delta.
raiseLayer: function ( layer, delta )