OpenLayers.Map
OpenLayers.Layer
OpenLayers.Layer.HTTPRequest
OpenLayers.Layer.Grid
OpenLayers.Layer.WMS
OpenLayers.Layer.KaMap
OpenLayers.Layer.EventPane
OpenLayers.Layer.Google
OpenLayers.Layer.VirtualEarth
OpenLayers.Layer.Markers
OpenLayers.Layer.Text
OpenLayers.Layer.GeoRSS
OpenLayers.Layer.Boxes
OpenLayers.Icon
OpenLayers.Marker
OpenLayers.Marker.Box
OpenLayers.Tile
OpenLayers.Tile.Image
OpenLayers.Tile.WFS
OpenLayers.Control
OpenLayers.Control.LayerSwitcher
OpenLayers.Control.MouseDefaults
OpenLayers.Control.MouseToolbar
OpenLayers.Control.PanZoom
OpenLayers.Control.PanZoomBar
OpenLayers.Control.Permalink
OpenLayers.Control.Scale
OpenLayers.LonLat
OpenLayers.Size
OpenLayers.Pixel
OpenLayers.Bounds

OpenLayers.Map

Instantiate class OpenLayers.Map in order to create a map. This is the central class in the API. Everything else is auxiliary.

Constructor

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.

Methods

Layer Management

addLayer(layer)noneadds a layer to the list currently set for the map.
addLayers([ layer, layer ])noneAdds multiple layers to a map.
removeLayer(layer)noneRemove a layer from the map.
setBaseLayer(layer)noneSets 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.

Control Management

addControl(control)noneAdds a control to the map.

Popup Management

addPopup(popup, exclusive)noneadds a popup to the map. If exclusive is set to true, then all other popups are closed first.
removePopup(popup)noneremoves an existing popup from the map.

Center management

setCenter(lonlat, zoom)noneSet 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.
pan(dx, dy)noneAllows user to pan by a value of screen pixels

Zoom Management

zoomTo(zoom)nonezoom to the given zoom level.
zoomIn()nonezoom in one level.
zoomOut()nonezoom out one level.
zoomToExtent(bounds)noneSet the map such that the bounds fits within the current viewport area.
zoomToMaxExtent()noneZoom such that the entire bounds of the map is contained in the viewport.
zoomToScale(float)noneZoom 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.

Current Map Information

getLonLatFromPixel(pixel)OpenLayers.LonLatReturns OpenLayers.LonLat corresponding to the given OpenLayers.Pixel, translated into lon/lat by the current base layer
getPixelFromLonLat(lonlat)OpenLayers.PixelReturns OpenLayers.Pixel corresponding to the given OpenLayers.LonLat, translated by the current base layer
getCenter()OpenLayers.LonLatReturns a LonLat for the current center of the map
getZoom()IntegerReturns the current zoom level as an integer
getExtent()OpenLayers.BoundsReturns a Bounds object which represents the geographic bounds of the current viewPort.
getSize()OpenLayers.PixelReturns the pixel size of the current map window.
getTileSize()OpenLayers.SizeReturns tile size currently set for map.
getResolution()floatReturns the current resolution (units/pixel) of the map
getZoomForExtent(bounds)Zoom level in which the given bounds will fitzooming 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.

Default Map Information

getMaxResolution()floatreturns 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.
getMaxExtent()OpenLayers.BoundsReturn the max extent of the current base layer as defined on the layer. The default maxExtent for OpenLayers is -180,-90,180,90
getMaxZoomLevel()intReturns the maximum zoom level that can be reached in the map for the current base layer
getMinZoomLevel()intReturns the minimum zoom level that can be reached in the map for the current base layer

Events

addlayera layer is added to the map
removelayera layer is removed from the map
changelayera layer has some property of it, typically visibility, changed.
changebaselayerthe current base layer changes
movestartstart of a movement in the map
zoomendend of a zoom action
mouseovermap is moused over
mouseoutmap is no longer mousedout
mousemovemouse moves inside map
dragstartdrag action starts
dragenddrag action ends

Options:

controlsan array of control objects to be added to the map. The default is [new OpenLayers.Control.MouseDefaults(), new OpenLayers.Control.PanZoom()]
projectionused by WMS layers, should be an SRS identifier.
maxZoomLevelThe number of zoom levels to use in the map.
maxExtentOpenLayers.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.
maxResolutionThe units/pixel measurement at zoom level 0. Default is 1.40625
resolutionsAn array of resolutions to be used as an index when zooming. Overrides maxZoomLevel and maxResolution if present.
minScaleThe smallest scale value. minScale is preferred over maxResolution, if present.
maxScaleThe maximum scale the map should include. Overrides maxZoomLevel if present.
unitsThe units of the map. Defaults to degrees. Neccesary when using scale in any way.
scalesAn array of scale values. Overrides maxResolution, maxZoomLevel, resolutions, and min/max scale if present.

OpenLayers.Layer

Layers are the most important and central aspect of OpenLayers. They are the core functionality for the software: Everything that ends up on the map comes from a layer. The base layer class is designed to be subclassed by any number of different layers.

Constructor

OpenLayers.Layer(name, options)All layers have a name as their first param. This name is used to display the layer in the LayerSwitcher, and for other purposes. The options parameter is used to replace any parameters of the Layer which need to be different.

Methods

clone()OpenLayers.Layercreate a clone of the layer.
setName(name)noneSet the name of the layer to something different.
moveTo(bounds, zoomChanged)noneNot implemented here, but the general function called on dragging or setCenter, to move the Layer to a new geographic location.
reproject()noneSubclassed by vector layers to redraw vectors when base layer changes.
setMap(map)noneSet the map property of the layer. Also set the parameters which are inherited from the map.
getVisibility()BooleanReturn true or false based on visibility of the layer.
setVisibility(visible)noneSet the layer visibility, and trigger the appropriate events.
getResolution()floatReturn the current resolution of the map, in units/pixel.
getExtent()OpenLayers.BoundsReturn the geographic extent of the current map viewport.
getZoomForExtent(bounds)Integerreturn the integer zoom which most closely matches the passed bounds.
getLonLatFromViewPortPx(pixel)OpenLayers.LonLatReturns an OpenLayers.LonLat which is the passed-in view port OpenLayers.Pixel, translated into lon/lat by the laye
getViewPortPxFromLonLat(lonlat)OpenLayers.PixelReturns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into view port pixels

Parameters

isBaseLayerThis determines whether the layer is a base layer or an overlay. Only one Base Layer can be displayed on the map at once. Default is false.
projectionSRS string to describe the layer. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxExtentan OpenLayers.Bounds for the layer. This is the maximum geographic extent of the layer. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxResolutionThe number of degrees per pixel at zoom level 0. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxZoomLevelThe maximum zoom level for the layer. If this is set on the map before the Layer is added to the map, it will inherit from the map.
minScaleThe scale at zoom level 0. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxScaleThe scale at the highest zoom level. If this is set on the map before the Layer is added to the map, it will inherit from the map.
unitsThe units the map is projected into. If this is set on the map before the Layer is added to the map, it will inherit from the map.

OpenLayers.Layer.HTTPRequest

Sublass of Layer used for services which require initiating multiple HTTPRequests.

Constructor

OpenLayers.Layer.HTTPRequest(name, url, params, options)URL is the base URL to the layer. Params is a set of params to be included in the HTTP Request. Options is a set of options, extending the parameters of the layer.

Methods

initResolutions()noneBased on the current minScale/maxScale/maxResolution/maxZoomLevels/scales/resolutions parameters, initializes an array of 'zoom levels' as this.resolutions, which are then used as an index into when zooming.
getFullRequestString(newParams)StringReturns the full request string for a combination of the defaults on this layer and the parameters passed via newParams.

OpenLayers.Layer.Grid

The Grid layer is the base layer for almost all image layers. This is a subclass of HTTPRequest.

Constructor

OpenLayers.Layer.Grid(name, url, params, options)URL is the base URL to the layer. Params is a set of params to be included in the HTTP Request. Options is a set of options, extending the parameters of the layer.

Methods

getGridBounds()OpenLayers.Boundsreturn geographic extent of the grid of tiles.
_initTiles()noneUsed to initialize the tile grid, creating image elements as neccesary and filling them with the correct images.
spiralTileLoad()noneCalled from _initTiles. Rotates through the grid filling in the images for the grid.
clone()OpenLayers.Layer.Gridcreate a clone of the layer. Subclassed from {OpenLayers.Layer}.
setMap(map)noneSet the map property of the layer. Also set the parameters which are inherited from the map. This is also where the tileSize is retrieved from the map. Subclassed from OpenLayers.Layer.
moveTo(bounds, zoomChanged)noneNot implemented here, but the general function called on dragging or setCenter, to move the Layer to a new geographic location. Subclassed from OpenLayers.Layer.
getResolution()floatReturn the current resolution of the map, in units/pixel. Subclassed from OpenLayers.Layer.
getExtent()OpenLayers.BoundsReturn the geographic extent of the current map viewport. Subclassed from {OpenLayers.Layer}.
getZoomForExtent(bounds)Integerreturn the integer zoom which most closely matches the passed bounds. Subclassed from OpenLayers.Layer.
getLonLatFromViewPortPx(pixel)OpenLayers.LonLatReturns an OpenLayers.LonLat which is the passed-in view port OpenLayers.Pixel, translated into lon/lat by the layer. Subclassed from {OpenLayers.Layer}.
getViewPortPxFromLonLat(lonlat)OpenLayers.PixelReturns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into view port pixels. Subclassed from {OpenLayers.Layer}.

Parameters

bufferDefault 2. Number of tiles around the central map area which OpenLayers will preload so that dragging goes more smoothly.

Subclassed from OpenLayers.Layer

isBaseLayerThis determines whether the layer is a base layer or an overlay. Only one Base Layer can be displayed on the map at once. Default is false.
projectionSRS string to describe the layer. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxExtentan OpenLayers.Bounds for the layer. This is the maximum geographic extent of the layer. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxResolutionThe number of degrees per pixel at zoom level 0. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxZoomLevelThe maximum zoom level for the layer. If this is set on the map before the Layer is added to the map, it will inherit from the map.
minScaleThe scale at zoom level 0. If this is set on the map before the Layer is added to the map, it will inherit from the map.
maxScaleThe scale at the highest zoom level. If this is set on the map before the Layer is added to the map, it will inherit from the map.
unitsThe units the map is projected into. If this is set on the map before the Layer is added to the map, it will inherit from the map.

OpenLayers.Layer.WMS

The WMS layer allows one to connect to a WMS server to obtain images. Params are available as a hash on the layer object, however, all keys are upper-cased automatically for maximum compatibility with WMS servers, so a parameter which is set as 'layers' will be uppercased to LAYERS. Where 'layer' is your Javscript variable for the layer, layer.params.LAYERS is the value of the layers param as set by the constructor. If you wish to change params, you should use mergeNewParams, rather than accessing the parameters directly.

Constructor

OpenLayers.Layer.WMS(name, url, params, options)URL is the base URL to the layer. Params is a set of params to be included in the HTTP Request. Options is a set of options, extending the parameters of the layer.

Methods

All other methods are inherited from OpenLayers.Layer.Grid
getURL(bounds)StringReturns a WMS URL for the given bounds based on the properties of the layer.

Options

isBaseLayerWMS layers default to being base layers unless one of their parameters is 'transparent':'true'.

OpenLayers.Layer.KaMap

ka-Map is a Mapserver wrapper which performs caching and works around many of the deficiencies with tiling when using Mapserver as a WMS client.

Construtor

OpenLayers.Layer.KaMap(name, url, params, options)URL is the url of the tile.php for KaMap.

OpenLayers.Layer.EventPane

Designed to act as a super-class for layers which need OpenLayers to intercept click events. Google Maps and Microsoft Virtual Earth both use this functionality, in order to allow for actions like the rubber-band-zoom/zoombox functionality. This Layer is not designed to be used on its own, but instead to act as an intermediary between the user and layers which have their own click handlers.

Constructor

OpenLayers.Layer.EventPane(name, options)Only designed to be used by subclasses.

OpenLayers.Layer.Google

The Google Layer in OpenLayers allows you to include Google Maps functionality in your OpenLayers maps. In order to use the Google Layer, you must first obtain an API key for Google Maps, and include the Google Maps API script in your page. Once you have done this,

Constructor

OpenLayers.Layer.Google(name, options?)Constructor for Google layer. Accepts name and options.

Methods

getOLLonLatFromGLatLng(GLonLat)OpenLayers.LonLatConvert from GLatLon to OpenLayers LonLat
getGLatLngFromOLLonLat(lonlat)GLatLonConvert From OpenLayers LonLat to GLatLon
getOLPixelFromGPoint(GPoint)OpenLayers.PixelConvert from GPoint to OpenLayers.Pixel
getGPointFromOLPixel(pixel)GPointCreate GPoint from OpenLayers Pixel.

Parameters

typeone of G_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, used to choose the type of map to display.

OpenLayers.Layer.VirtualEarth

The Virtual Earth Layer in OpenLayers allows you to include Virtual Earth Maps in your OpenLayers maps. In order to use the Virtual Earth Layer, you must first include the Virtual Earth API script in your page. Once you have done this, simply add the layer to your map.

Constructor

OpenLayers.Layer.VirtualEarth(name)Constructor for Virtual Earth layer. Accepts name.

Methods

getOLLonLatFromVELatLng(VELatLon)OpenLayers.LonLatConvert from VELatLon to OpenLayers LonLat
getVELatLngFromOLLonLat(lonlat)VELatLonConvert From OpenLayers LonLat to VELatLon
getOLPixelFromVEPoint(Msn.VE.Pixel)OpenLayers.PixelConvert from VEPoint to OpenLayers.Pixel
getGPointFromOLPixel(pixel)Msn.VE.PixelCreate Msvn.VE.Pixel from OpenLayers Pixel.

OpenLayers.Layer.Markers

The base class for all vector drawing, The OpenLayers.Layer.Markers layer is the primary way to get annotations into your map.

Constructor

OpenLayers.Layer.Markers(name, options)Name and options for layer.

Methods

addMarker(Marker)noneAdds a marker to the layer, sets the map object on the marker, and calls drawMarker on the marker.
removeMarker(Marker)noneRemove the marker from the layer and map.
clearMarkers()noneRemove all markers from the layer with removeMarker.
redraw()noneRedraw all markers. Used so that markers can change their position when a base layer changes.
drawMarkernoneCall marker.draw(px), which passes the Pixel of the latitude/longitude in the map viewport to the marker. adds the marker to the div, and marks the marker as drawn.

OpenLayers.Layer.Text

Subclass of Markers layer which retrieves CSV file from the web, and parses content to create markers and popups.

Constructor

OpenLayers.Layer.Text(name, options)Pass in name, and set location: 'URL of CSV file' in the options hash.

Methods

parseData(ajaxRequest)noneParses returned CSV file.

OpenLayers.Layer.GeoRSS

GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map. The GeoRSS layer supports 1.0 and 2.0 in IE and Firefox, and supports 2.0 in Safari. (Ticket #111 explains the reason for this difference.)

Constructor

OpenLayers.Layer.GeoRSS(name, url)Name and location of GeoRSS XML file.

Methods

parseData(ajaxResponse)noneCallback for the loadURL call. This function parses the XML for the GeoRSS feed, creating markers for the data and adding a popup to each marker. It populates an array of features as 'this.features'.
markerClick(Event)noneAction to perform when a marker is clicked.
clearFeatures()noneRemoves all features and markers from the map.

OpenLayers.Layer.Boxes

A subclass of the markers layer, this layer draws boxes using div elements instead of icons using images.

Constructor

OpenLayers.Layer.Boxes(name, options)Same as OpenLayers.Layer.Markers.

OpenLayers.Icon

Icon is used as the visual representation of a Marker. Creating such a representation requres up to three parts: An Icon URL, a size, and an offset. The icon URL is a pointer to an image to use as an icon. The size is the size of the image, as an OpenLayers.Size object, and the offset is the position of the top left corner of the image in pixels, relative to the latitude and longitude of the Marker.

Constructor

OpenLayers.Icon(url, size, offset)creates a new icon.

Methods

clone()OpenLayers.IconCreate an exact copy of the icon.

OpenLayers.Marker

Instantiate class OpenLayers.Marker in order to create a marker.

Constructor

OpenLayers.Marker(lonlat, icon? )Creates a new marker object. This object must be added to a Marker layer and will then be displayed. The icon can be left nullif this is the case, then the default OpenLayers icon will be used.

Methods

onScreen()booleanReturns whether or not the marker is currently visible on screen.
inflate(float)noneChanges the size of the Icon by a factor of the passed float.
display(string)noneSets the style.display property of the Icon.

Events

Standard browser events are available.

OpenLayers.Marker.Box

A different kind of Marker, designed to be added to a Boxes layer instead of a Markers layer.

Constructor

OpenLayers.Marker.Box(bounds, borderColor, borderWidth)Set up a box. Defaults are red, with a width of 2.

Methods

setBorder(color, width)sets properties of border color and width.

OpenLayers.Tile

This is a class designed to designate a single tile, however it is explicitly designed to do relatively little. Tiles store information about themselvessuch as the URL that they are related to, and their size - but do not add themselves to the layer div automatically, for example.

Constructor

OpenLayers.Tile(layer, position, bounds, url, size)Create a new tile, with properties passed.

OpenLayers.Tile.Image

The image tile is designed to hold images for all types of layers, from WMS to KaMap to WorldWind.

Constructor

OpenLayers.Tile.Image(layer, position, bounds, url, size)Create a new tile, with properties passed.

OpenLayers.Tile.WFS

The WFS tile allows you to load any number of WFS URLs into a single tile.

Constructor

OpenLayers.Tile.WFS(layer, position, bounds, urls, size)Create a new tile, with properties passed. The major difference between this tile and other tiles is what it does with results: The WFS tile is designed to parse XML responses, and create features for each item in the response.

OpenLayers.Control

Base class from which controls are derived. Controls are elements of the map used to control things like zoom, layer status, or to provide information to the user about the status of the map, such as scale or copyright information.

Constructor

OpenLayers.Control(options?)Creates a new control. The options here are used to control parameters of the control. The base control defines only "position", which is designed to be an OpenLayers.Pixel which is the top-left of the location of the control relative to the map div.

Parameters

positionOpenLayers.Pixel to use as the top-left corner of the control div, relative to the map area.

OpenLayers.Control.LayerSwitcher

This control will by default display a small image in the upper right corner of the map. When clicked, this image expands into a control which allows one to select between multiple types of layers, seperated into two types: Base Layers and Overlays. Only one base layer can be selected at a time, and is enforced by a radio button control being used. Multiple overlays can be selected at once, and a checkbox control is visible for this functionality.

Constructor

OpenLayers.Control.LayerSwitcher(options?)Creates a new control.

Methods

maximizeControl()noneExpand the layer switcher control.
minimizeControl()noneClose the layer switcher control.

Parameters

position(inherited from OpenLayers.Control) {OpenLayers.Pixel} to use as the top-left corner of the control div, relative to the map area.
activeColorThe color to use for the background of the layer switcher div.

OpenLayers.Control.MouseDefaults

Control to set up mouse handling. This includes clicks, double clicks, scrollwheel events, and mouse movement. There are a number of functions which act as the default handlers for these events: if you wish to create your own mouse control which behaves differently, you should create a subclass of MouseDefaults, replacing the functions whose behavior you wish to change.

Constructor

OpenLayers.Control()Creates a new control. No options available.

Methods

defaultClicknoneThis event takes place when a click event occurs on the map.
defaultDblClicknoneThis event re-centers the map on the clicked location.
defaultMouseDownnoneThis event starts a dragging event, so that the map can be dragged. If the shift key is held, it starts a 'zoombox' or rubber-band-zoom action instead.
defaultMouseMovenoneIf a mouseDrag is in operation, this function causes the map to move to follow the cursor. If a zoombox is in place, this increases the size of the zoombox element to match the cursor.
defaultMouseUpnoneThis function is called when a mouseup event is received, and either sets the center of the map to be the final location or zooms to the zoombox if enabled.
defaultMouseOutnoneThis calls defaultMouseUp, so that when you mouse out of the map div, the events are stopped.
defaultWheelUpnoneZooms in one level. Called by onWheelEvent
defaultWheelDownnoneZooms out one level. Called by onWheelEvent.
onWheelEventnonecatches the map wheel event, and handles it, zooming appropriately.

OpenLayers.Control.MouseToolbar

Control to set up mouse handling. This includes clicks, double clicks, scrollwheel events, and mouse movement. There are a number of functions which act as the default handlers for these events: if you wish to create your own mouse control which behaves differently, you should create a subclass of MouseToolbar, replacing the functions whose behavior you wish to change. Additionally, a toolbar of images can be clicked to start events, as well as using the keyboard shortcuts.

Constructor

OpenLayers.Control.MouseToolbar(position, direction)Creates a new control. The direction of the control can be either "vertical" or "horizontal". The default is vertical.

Methods

defaultClicknoneThis event takes place when a click event occurs on the map.
defaultDblClicknoneThis event re-centers the map on the clicked location.
defaultMouseDownnoneThis event starts a dragging event, so that the map can be dragged. If the shift key is held, it starts a 'zoombox' or rubber-band-zoom action instead.
defaultMouseMovenoneIf a mouseDrag is in operation, this function causes the map to move to follow the cursor. If a zoombox is in place, this increases the size of the zoombox element to match the cursor.
defaultMouseUpnoneThis function is called when a mouseup event is received, and either sets the center of the map to be the final location or zooms to the zoombox if enabled.
defaultMouseOutnoneThis calls defaultMouseUp, so that when you mouse out of the map div, the events are stopped.

OpenLayers.Control.PanZoom

Creates a small toolset for controlling the location of the map with panning and zooming, including four directional arrows, a zoom in and zoom out, and one button which zooms to the max extent of the map.

Constructor

OpenLayers.Control.PanZoom(options)Creates a new panzoom control.

Parameters

slideFactorNumber of pixels by which to slide the map when a pan arrow is clicked.

OpenLayers.Control.PanZoom

Creates a small toolset for controlling the location of the map with panning and zooming, including four directional arrows, a zoom in and zoom out, and a bar on which a slider can be moved to zoom in or out by multiple stops at once.

Constructor

OpenLayers.Control.PanZoomBar()Creates a new panzoombar control.

OpenLayers.Control.Permalink

A small control which updates a "Permalink" to the map every time the viewport changes. This allows users to copy a link to a specfic map view. By default, it places itself in the lower right corner of the map. This control must be added to the map after a baselayer has been set.

Constructor

OpenLayers.Control.Scale(element?, base)Creates a new permalink control. The DOMElement is used, if passed, as the element on which the 'href' is set. If you prefer to put this link on an element outside of the map, set this element to an anchor element to have its href updated when the map moves. If you wish to make the link go to some other URL (for example, an editing interface rather than the current URL), the 'base' property can be used, to which the ?lat=&lon=&zoom= will be appended after the map has moved.

OpenLayers.Control.Scale

A small control which displays an informative scale value, a la "1:50K" , by defualt in the lower right of the map viewport.

Constructor

OpenLayers.Control.Scale(element?)Creates a new scale control. The DOMElement is used, if passed, to put the scale insidethis allows you to have the scale displayed in some location outside the map.

OpenLayers.LonLat

This class represents a geographic coordinate pair, either projected or unprojected.

Constructor

OpenLayers.LonLat(lon, lat)Create LonLat.

Methods

toString()StringConverts to human readable string.
toShortString()StringConverts to short human readable string.
clone()OpenLayers.SizeReturns a copy of the pixel.
equals(ll)BooleanCompares two LonLats.
add(lon, lat)OpenLayers.LonLatadd x and y to the current coordinates.

OpenLayers.Size

This class represents a width/height pair.

Constructor

OpenLayers.Size(h, w)Create Size.

Methods

toString()StringConverts to human readable string.
clone()OpenLayers.SizeReturns a copy of the pixel.
add(x, y)OpenLayers.Sizeadd x and y to the current coordinates.

OpenLayers.Pixel

This class represents a screen coordinate in x and y coordinates.

Constructor

OpenLayers.Pixel(x, y)Create Pixel.

Methods

toString()StringConverts to human readable string.
clone()OpenLayers.PixelReturns a copy of the pixel.
equals(px)BooleanTests for equivilance.
add(x, y)OpenLayers.Pixeladd x and y to the current coordinates.
offset(pixel)OpenLayers.PixelAdd pixels together.

OpenLayers.Bounds

This class represents a bounding box. Data stores as left, bottom, right, top floats.

Constructor

OpenLayers.Bounds(left, bottom, right, top)Create new Bounds.

Methods

clone()OpenLayers.BoundsReturn copy of the current bounds.
toString()StringReturn bounds as string.
toBBOX()StringReturn bounds as simple string, usable for WMS.
getWidth()floatReturn width of bounds.
getHeight()floatReturn height of bounds.
getSize()OpenLayers.SizeReturn size of bounds.
getCenterPixel()OpenLayers.PixelReturn center of bounds as pixel.
getCenterLonLat()OpenLayers.LonLatReturn center of bounds as LonLat.
equals(bounds)Booleanwhether or not the bounds are equivilant.
add(x, y)OpenLayers.BoundsShift bounds by x and y.
contains(x, y, inclusive)BooleanReturn Whether or not the passed-in coordinates are within this bounds
containsBounds(bounds, partial, inclusive)BooleanReturns whether or not the passed-in OpenLayers.Bounds object is contained within this bounds. partial indicates whether bounds must be contained or only overlap. Inclusive determines whether border is included.
determineQuadrant(lonlat)StringDetermine which quadrant the LonLat is in. Returns combination of "b" or "t" and "l" or "r".