1 |
3032
|
perry
|
OpenLayers.Map
|
2 |
|
|
|
3 |
|
|
Instantiate class {OpenLayers.Map} in order to create a map. This is the central class in the API. Everything else is auxiliary.
|
4 |
|
|
|
5 |
|
|
* Constructor
|
6 |
|
|
OpenLayers.Map(container, opts?) -- Creates a new map inside of the given HTML container, which is typically a DIV element. The opts variable is an object with various options, as described in the options section below.
|
7 |
|
|
|
8 |
|
|
* Methods
|
9 |
|
|
* Layer Management
|
10 |
|
|
addLayer({OpenLayers.Layer|layer}) -- none -- adds a layer to the list currently set for the map.
|
11 |
|
|
addLayers([ {OpenLayers.Layer|layer}, {OpenLayers.Layer|layer} ]) -- none -- Adds multiple layers to a map.
|
12 |
|
|
removeLayer({OpenLayers.Layer|layer}) -- none -- Remove a layer from the map.
|
13 |
|
|
setBaseLayer({OpenLayers.Layer|layer}) -- none -- Sets a new base layer for the map. The provided layer should have already been added to the map. Changing the base layer causes all other base layers to be turned off, and all overlays to reproject themselves.
|
14 |
|
|
|
15 |
|
|
* Control Management
|
16 |
|
|
addControl({OpenLayers.Control|control}) -- none -- Adds a control to the map.
|
17 |
|
|
|
18 |
|
|
* Popup Management
|
19 |
|
|
addPopup({OpenLayers.Popup|popup}, {Boolean|exclusive}) -- none -- adds a popup to the map. If exclusive is set to true, then all other popups are closed first.
|
20 |
|
|
removePopup({OpenLayers.Popup|popup}) -- none -- removes an existing popup from the map.
|
21 |
|
|
|
22 |
|
|
* Center management
|
23 |
|
|
setCenter({OpenLayers.LonLat|lonlat}, {int|zoom}) -- none -- Set the center point of the map. This then moves all the layers to the new center location as well, using each layer's 'moveTo' function. The 'zoom' is an integer from 0 to maxZoomLevel.
|
24 |
|
|
pan({Integer|dx}, {Integer|dy}) -- none -- Allows user to pan by a value of screen pixels
|
25 |
|
|
|
26 |
|
|
* Zoom Management
|
27 |
|
|
zoomTo({int|zoom}) -- none -- zoom to the given zoom level.
|
28 |
|
|
zoomIn() -- none -- zoom in one level.
|
29 |
|
|
zoomOut() -- none -- zoom out one level.
|
30 |
|
|
zoomToExtent({OpenLayers.Bounds|bounds}) -- none -- Set the map such that the bounds fits within the current viewport area.
|
31 |
|
|
zoomToMaxExtent() -- none -- Zoom such that the entire bounds of the map is contained in the viewport.
|
32 |
|
|
zoomToScale({float}) -- none -- Zoom as close to the given scale as possible. Scale can be given as a ratio (1/24000) or as the denominator of the scale value (24000). zoomToScale will find the zoom level which most closely fits the requested scale and set that as the current zoom level.
|
33 |
|
|
|
34 |
|
|
* Current Map Information
|
35 |
|
|
getLonLatFromPixel({OpenLayers.Pixel|pixel}) -- {OpenLayers.LonLat} -- Returns OpenLayers.LonLat corresponding to the given OpenLayers.Pixel, translated into lon/lat by the current base layer
|
36 |
|
|
getPixelFromLonLat({OpenLayers.LonLat|lonlat}) -- {OpenLayers.Pixel} -- Returns OpenLayers.Pixel corresponding to the given OpenLayers.LonLat, translated by the current base layer
|
37 |
|
|
getCenter() -- {OpenLayers.LonLat} -- Returns a LonLat for the current center of the map
|
38 |
|
|
getZoom() -- {Integer} -- Returns the current zoom level as an integer
|
39 |
|
|
getExtent() -- {OpenLayers.Bounds} -- Returns a Bounds object which represents the geographic bounds of the current viewPort.
|
40 |
|
|
getSize() -- {OpenLayers.Pixel} -- Returns the pixel size of the current map window.
|
41 |
|
|
getTileSize() -- {OpenLayers.Size} -- Returns tile size currently set for map.
|
42 |
|
|
getResolution() -- {float} -- Returns the current resolution (units/pixel) of the map
|
43 |
|
|
getZoomForExtent({OpenLayers.Bounds|bounds}) -- Zoom level in which the given bounds will fit -- zooming to this level and setting the center of the map in the center of the bounds will always fit the given bounds in the map.
|
44 |
|
|
|
45 |
|
|
* Default Map Information
|
46 |
|
|
getMaxResolution() -- {float} -- returns The Map's Maximum Resolution, the units/pixel at zoom level 0. The default is 1.40625, to match the approximate MaxResolution used by the commercial providers.
|
47 |
|
|
getMaxExtent() -- {OpenLayers.Bounds} -- Return the max extent of the current base layer as defined on the layer. The default maxExtent for OpenLayers is -180,-90,180,90
|
48 |
|
|
getMaxZoomLevel() -- {int} -- Returns the maximum zoom level that can be reached in the map for the current base layer
|
49 |
|
|
getMinZoomLevel() -- {int} -- Returns the minimum zoom level that can be reached in the map for the current base layer
|
50 |
|
|
|
51 |
|
|
* Events
|
52 |
|
|
addlayer -- a layer is added to the map
|
53 |
|
|
removelayer -- a layer is removed from the map
|
54 |
|
|
changelayer -- a layer has some property of it, typically visibility, changed.
|
55 |
|
|
changebaselayer -- the current base layer changes
|
56 |
|
|
movestart -- start of a movement in the map
|
57 |
|
|
zoomend -- end of a zoom action
|
58 |
|
|
mouseover -- map is moused over
|
59 |
|
|
mouseout -- map is no longer mousedout
|
60 |
|
|
mousemove -- mouse moves inside map
|
61 |
|
|
dragstart -- drag action starts
|
62 |
|
|
dragend -- drag action ends
|
63 |
|
|
|
64 |
|
|
* Options:
|
65 |
|
|
* controls -- an array of control objects to be added to the map. The default is [new OpenLayers.Control.MouseDefaults(), new OpenLayers.Control.PanZoom()]
|
66 |
|
|
* projection -- used by WMS layers, should be an SRS identifier.
|
67 |
|
|
* maxZoomLevel -- The number of zoom levels to use in the map.
|
68 |
|
|
* maxExtent -- {OpenLayers.Bounds} to be used as the maximum extent of a map. The center of the map can not leave the maxExtent of the map when dragging.
|
69 |
|
|
* maxResolution -- The units/pixel measurement at zoom level 0. Default is 1.40625
|
70 |
|
|
* resolutions -- An array of resolutions to be used as an index when zooming. Overrides maxZoomLevel and maxResolution if present.
|
71 |
|
|
* minScale -- The smallest scale value. minScale is preferred over maxResolution, if present.
|
72 |
|
|
* maxScale -- The maximum scale the map should include. Overrides maxZoomLevel if present.
|
73 |
|
|
* units -- The units of the map. Defaults to degrees. Neccesary when using scale in any way.
|
74 |
|
|
* scales -- An array of scale values. Overrides maxResolution, maxZoomLevel, resolutions, and min/max scale if present.
|