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) | none | adds a layer to the list currently set for the map. |
addLayers([ layer, layer ]) | none | Adds multiple layers to a map. |
removeLayer(layer) | none | Remove a layer from the map. |
setBaseLayer(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. |
Control Management
addControl(control) | none | Adds a control to the map. |
Popup Management
addPopup(popup, exclusive) | none | adds a popup to the map. If exclusive is set to true, then all other popups are closed first. |
removePopup(popup) | none | removes an existing popup from the map. |
Center management
setCenter(lonlat, 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. |
pan(dx, dy) | none | Allows user to pan by a value of screen pixels |
Zoom Management
zoomTo(zoom) | none | zoom to the given zoom level. |
zoomIn() | none | zoom in one level. |
zoomOut() | none | zoom out one level. |
zoomToExtent(bounds) | none | Set the map such that the bounds fits within the current viewport area. |
zoomToMaxExtent() | none | Zoom such that the entire bounds of the map is contained in the viewport. |
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. |
Current Map Information
getLonLatFromPixel(pixel) | OpenLayers.LonLat | Returns OpenLayers.LonLat corresponding to the given OpenLayers.Pixel, translated into lon/lat by the current base layer |
getPixelFromLonLat(lonlat) | OpenLayers.Pixel | Returns OpenLayers.Pixel corresponding to the given OpenLayers.LonLat, translated by the current base layer |
getCenter() | OpenLayers.LonLat | Returns a LonLat for the current center of the map |
getZoom() | Integer | Returns the current zoom level as an integer |
getExtent() | OpenLayers.Bounds | Returns a Bounds object which represents the geographic bounds of the current viewPort. |
getSize() | OpenLayers.Pixel | Returns the pixel size of the current map window. |
getTileSize() | OpenLayers.Size | Returns tile size currently set for map. |
getResolution() | float | Returns the current resolution (units/pixel) of the map |
getZoomForExtent(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. |
Default Map Information
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. |
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 |
getMaxZoomLevel() | int | Returns the maximum zoom level that can be reached in the map for the current base layer |
getMinZoomLevel() | int | Returns the minimum zoom level that can be reached in the map for the current base layer |
Events
addlayer | a layer is added to the map |
removelayer | a layer is removed from the map |
changelayer | a layer has some property of it, typically visibility, changed. |
changebaselayer | the current base layer changes |
movestart | start of a movement in the map |
move | end of movement in a map. this happens while te mouse is dragging as well as for all other events. |
moveend | end of movement in a map, but does not happen when the 'dragging' flag is set, as is the case when the move event is in the middle of a drag action. |
zoomend | end of a zoom action |
mouseover | map is moused over |
mouseout | map is no longer mousedout |
mousemove | mouse moves inside map |
dragstart | drag action starts |
dragend | drag action ends |
Options:
controls | an array of control objects to be added to the map. The default is [new OpenLayers.Control.MouseDefaults(), new OpenLayers.Control.PanZoom()] |
projection | used by WMS layers, should be an SRS identifier. |
maxZoomLevel | The number of zoom levels to use in the map. |
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. |
maxResolution | The units/pixel measurement at zoom level 0. Default is 1.40625 |
resolutions | An array of resolutions to be used as an index when zooming. Overrides maxZoomLevel and maxResolution if present. |
minScale | The smallest scale value. minScale is preferred over maxResolution, if present. |
maxScale | The maximum scale the map should include. Overrides maxZoomLevel if present. |
units | The units of the map. Defaults to degrees. Neccesary when using scale in any way. |
scales | An array of scale values. Overrides maxResolution, maxZoomLevel, resolutions, and min/max scale if present. |
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.Layer | create a clone of the layer. |
setName(name) | none | Set the name of the layer to something different. |
moveTo(bounds, zoomChanged) | none | Not implemented here, but the general function called on dragging or setCenter, to move the Layer to a new geographic location. |
setMap(map) | none | Set the map property of the layer. Also set the parameters which are inherited from the map. |
getVisibility() | Boolean | Return true or false based on visibility of the layer. |
setVisibility(visible) | none | Set the layer visibility, and trigger the appropriate events. |
getResolution() | float | Return the current resolution of the map, in units/pixel. |
getExtent() | OpenLayers.Bounds | Return the geographic extent of the current map viewport. |
getZoomForExtent(bounds) | Integer | return the integer zoom which most closely matches the passed bounds. |
getLonLatFromViewPortPx(pixel) | OpenLayers.LonLat | Returns an OpenLayers.LonLat which is the passed-in view port OpenLayers.Pixel, translated into lon/lat by the laye |
getViewPortPxFromLonLat(lonlat) | OpenLayers.Pixel | Returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into view port pixels |
addOptions(options)) | none | Change the options on the layer. This is the supported way to change properties of the layer. |
Parameters
displayOutsideMaxExtent | Determine whether images or data are loaded outside the maxExtent. Default is false. |
isBaseLayer | This 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. |
projection | SRS 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. |
maxExtent | an 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. |
maxResolution | The 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. |
maxZoomLevel | The 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. |
minScale | The 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. |
maxScale | The 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. |
units | The 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. |
The Image Layer allows you to load a single image and use it as a layer in your
map.
Constructor
OpenLayers.Layer(name, url, bounds, size, options) | Image Layer constructor requires a name, URL of the image, geographic bounds of the image, pixel size of the image, and an optional options parameter. |
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() | none | Based on the current minScale/maxScale/maxResolution/numZoomLevel/scales/resolutions parameters, initializes an array of 'zoom levels' as this.resolutions, which are then used as an index into when zooming. |
getFullRequestString(newParams) | String | Returns the full request string for a combination of the defaults on this layer and the parameters passed via newParams. |
Options
reproject | If reproject is true, then the layer will alter the bounding boxes of its tiles to be based on the geographic location of the pixel bounds in the base layer. This is important for reprojecting WMS tiles onto something like Google Maps. Tile locations are calculated, and then when creating the tile request, the bounding box is adjusted to match the bounding box of the base layer at that location. |
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.Bounds | return geographic extent of the grid of tiles. |
_initTiles() | none | Used to initialize the tile grid, creating image elements as neccesary and filling them with the correct images. |
spiralTileLoad() | none | Called from _initTiles. Rotates through the grid filling in the images for the grid. |
clone() | OpenLayers.Layer.Grid | create a clone of the layer. Subclassed from {OpenLayers.Layer}. |
setMap(map) | none | Set 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) | none | Not 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() | float | Return the current resolution of the map, in units/pixel. Subclassed from OpenLayers.Layer. |
getExtent() | OpenLayers.Bounds | Return the geographic extent of the current map viewport. Subclassed from {OpenLayers.Layer}. |
getZoomForExtent(bounds) | Integer | return the integer zoom which most closely matches the passed bounds. Subclassed from OpenLayers.Layer. |
getLonLatFromViewPortPx(pixel) | OpenLayers.LonLat | Returns 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.Pixel | Returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into view port pixels. Subclassed from {OpenLayers.Layer}. |
Parameters
buffer | Default 2. Number of tiles around the central map area which OpenLayers will preload so that dragging goes more smoothly. |
Subclassed from OpenLayers.Layer
isBaseLayer | This 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. |
projection | SRS 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. |
maxExtent | an 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. |
maxResolution | The 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. |
maxZoomLevel | The 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. |
minScale | The 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. |
maxScale | The 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. |
units | The 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. |
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
getURL(bounds) | String | Returns a WMS URL for the given bounds based on the properties of the layer. |
All other methods are inherited from OpenLayers.Layer.Grid
Options
isBaseLayer | WMS layers default to being base layers unless one of their parameters is 'transparent':'true'. |
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. |
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. |
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.LonLat | Convert from GLatLon to OpenLayers LonLat |
getGLatLngFromOLLonLat(lonlat) | GLatLon | Convert From OpenLayers LonLat to GLatLon |
getOLPixelFromGPoint(GPoint) | OpenLayers.Pixel | Convert from GPoint to OpenLayers.Pixel |
getGPointFromOLPixel(pixel) | GPoint | Create GPoint from OpenLayers Pixel. |
Parameters
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.LonLat | Convert from VELatLon to OpenLayers LonLat |
getVELatLngFromOLLonLat(lonlat) | VELatLon | Convert From OpenLayers LonLat to VELatLon |
getOLPixelFromVEPoint(Msn.VE.Pixel) | OpenLayers.Pixel | Convert from VEPoint to OpenLayers.Pixel |
getGPointFromOLPixel(pixel) | Msn.VE.Pixel | Create Msvn.VE.Pixel from OpenLayers Pixel. |
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) | none | Adds a marker to the layer, sets the map object on the marker, and calls drawMarker on the marker. |
removeMarker(Marker) | none | Remove the marker from the layer and map. |
clearMarkers() | none | Remove all markers from the layer with removeMarker. |
redraw() | none | Redraw all markers. Used so that markers can change their position when a base layer changes. |
drawMarker | none | Call 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. |
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) | none | Parses returned CSV file. |
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) | none | Callback 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) | none | Action to perform when a marker is clicked. |
clearFeatures() | none | Removes all features and markers from the map. |
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. |
The TMS layer allows one to connect to a TMS | Tiled Map Service | server to obtain images. |
Constructor
OpenLayers.Layer.TMS(name, url, options) | URL is the base URL to the layer. Options is a set of options, extending the parameters of the layer. |
Methods
getURL(bounds) | String | Returns a TMS URL for the given bounds based on the properties of the layer. |
All other methods are inherited from OpenLayers.Layer.Grid
Options
tileOrigin | The tileOrigin option will allow you to set your tileOrigin to something other than the lower left extent of your map. |
layername | Name of the layer in the TMS request. |
type | The extension images have. |
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
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 null | if this is the case, then the default OpenLayers icon will be used. |
Methods
onScreen() | boolean | Returns whether or not the marker is currently visible on screen. |
inflate(float) | none | Changes the size of the Icon by a factor of the passed float. |
display(string) | none | Sets the style.display property of the Icon. |
Events
Standard browser events are available.
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. |
This is a class designed to designate a single tile, however
it is explicitly designed to do relatively little. Tiles store information
about themselves | such as the URL that they are related to, and their |
size - but do not add themselves to the layer div automatically, for
example.
Constructor
The image tile is designed to hold images for all types of layers, from WMS to KaMap to WorldWind.
Constructor
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. |
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
position | OpenLayers.Pixel to use as the top-left corner of the control div, relative to the map area. |
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() | none | Expand the layer switcher control. |
minimizeControl() | none | Close 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. |
activeColor | The color to use for the background of the layer switcher div. |
ascending | Ascending determines whether layers are added to the layer switcher in ascending or descending order. If ascending is true, the lowest layer is appended to the list first. If ascending is false, the lowest layer is at the very bottom of the LayerSwitcher. Default is true. |
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
defaultClick | none | This event takes place when a click event occurs on the map. |
defaultDblClick | none | This event re-centers the map on the clicked location. |
defaultMouseDown | none | This 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. |
defaultMouseMove | none | If 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. |
defaultMouseUp | none | This 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. |
defaultMouseOut | none | This calls defaultMouseUp, so that when you mouse out of the map div, the events are stopped. |
defaultWheelUp | none | Zooms in one level. Called by onWheelEvent |
defaultWheelDown | none | Zooms out one level. Called by onWheelEvent. |
onWheelEvent | none | catches the map wheel event, and handles it, zooming appropriately. |
A small control which displays the Longitude and Latitude of the current mouse position, by defualt in the lower right of the map viewport.
Constructor
OpenLayers.Control.MousePosition(options) | Creates a new MousePosition control. |
Parameters
element | if not null, div in which to display the MousePosition |
prefix | html to precede the longitude value (default: '') |
separator | html to separate the longitude and latitude values (default: ' ') |
suffix | html to follow the latitude value (default: '') |
numdigits | number of digits to the right of the decimal (default: 5) |
granularity | Don't refresh display if mouse has moved more than this (default: 10) |
prefix, separator, and suffix are used to format the lon/lat values.
With:
prefix = 'Lon: '
suffix = '
Lat: '
suffix = ''
nudigits = 3
Lon/Lat is displayed as:
Lon: 95.123
Lat: 35.456
If the mouse has never been over the map, Lon/Lat will equal 0/0. If the mouse is over the map, Lon/Lat will equal the current mouse position. If the mouse has been moved off the map, Lon/Lat will equal the value displayed at the time the mouse was moved off the map.
If the mouse is moving slowly, the Lon/Lat will refresh continuously. If the mouse is moving rapidly, the refresh of Lon/Lat will be suspended until the mouse has slowed down or stopped. (Trying to update the Lon/Lat value while the mouse is in rapid movemement makes the movement of the mouse unacceptably jerky.)
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. Note that if you wish to use the MouseToolbar, you *must* add a 'controls' option to the map constructor, otherwise you will have both MouseDefaults and MouseToolbar on the map, which will not work.
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
defaultClick | none | This event takes place when a click event occurs on the map. |
defaultDblClick | none | This event re-centers the map on the clicked location. |
defaultMouseDown | none | This 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. |
defaultMouseMove | none | If 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. |
defaultMouseUp | none | This 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. |
defaultMouseOut | none | This calls defaultMouseUp, so that when you mouse out of the map div, the events are stopped. |
This control provides a locator or overview map linked to another map. By default, the overview map shows up in the lower right of the main map and can be expdaned with the '+' button.
Constructor
OpenLayers.Control.OverviewMap(opts?) | Creates a new overview map. The opts variable is an object with various options, as described in the options section below.
|
Methods
isSuitableOverview() | Boolean | Determines if the overview map is suitable given the extent and resolution of the main map.
|
getRectPxBounds() | bounds | An OpenLayers.Bounds which is the extent rectangle's pixel bounds (relative to the parent element).
|
setRectPxBounds(bounds) | none | Set extent rectangle pixel bounds.
|
getRectBoundsFromMapBounds(lonLatBounds) | bounds | An OpenLayers.Bounds which is the passed-in map lon/lat extent translated into pixel bounds for the overview map.
|
getMapBoundsFromRectBounds(pxBounds]) | bounds | An OpenLayers.Bounds which is the passed-in overview rect bounds translated into lon/lat bounds for the overview map.
|
getLonLatFromOverviewPx(pixel) | lonlat | An OpenLayers.LonLat which is the passed-in overview map OpenLayers.Pixel translated into lon/lat by the overview map.
|
getOverviewPxFromLonLat(lonlat) | pixel | An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into overview map pixels
|
Events
Rectangle events
They are defined on OverviewMap.rectEvents
mouseover | rectangle is moused over
|
mouseout | rectangle is no longer mousedout
|
mousemove | mouse moves inside rectangle
|
mousedown | mouse button is pressed over the rectangle.
|
mouseup | mouse button is released over the rectangle.
|
click | mouse clicked
|
dblclick | mouse double clicked
|
Map events
They are defined on OverviewMap.mapDivEvents
click | mouse clicked
|
Options:
minRatio | The ratio of the overview map resolution to the main map resolution at which to zoom farther out on the overview map.
|
maxRatio | The ratio of the overview map resolution to the main map resolution at which to zoom farther in on the overview map.
|
layers | Ordered list of layers in the overview map. If none, then the map base layer is used.
|
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
slideFactor | Number of pixels by which to slide the map when a pan arrow is clicked. |
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. |
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. |
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 inside | this allows you to have the scale displayed in some location outside the map. |
This class represents a geographic coordinate pair, either projected or unprojected.
Constructor
OpenLayers.LonLat(lon, lat) | Create LonLat. |
Methods
toString() | String | Converts to human readable string. |
toShortString() | String | Converts to short human readable string. |
clone() | OpenLayers.Size | Returns a copy of the pixel. |
equals(ll) | Boolean | Compares two LonLats. |
add(lon, lat) | OpenLayers.LonLat | add x and y to the current coordinates. |
This class represents a width/height pair.
Constructor
OpenLayers.Size(h, w) | Create Size. |
Methods
toString() | String | Converts to human readable string. |
clone() | OpenLayers.Size | Returns a copy of the pixel. |
add(x, y) | OpenLayers.Size | add x and y to the current coordinates. |
This class represents a screen coordinate in x and y coordinates.
Constructor
OpenLayers.Pixel(x, y) | Create Pixel. |
Methods
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.Bounds | Return copy of the current bounds. |
toString() | String | Return bounds as string. |
toBBOX() | String | Return bounds as simple string, usable for WMS. |
getWidth() | float | Return width of bounds. |
getHeight() | float | Return height of bounds. |
getSize() | OpenLayers.Size | Return size of bounds. |
getCenterPixel() | OpenLayers.Pixel | Return center of bounds as pixel. |
getCenterLonLat() | OpenLayers.LonLat | Return center of bounds as LonLat. |
equals(bounds) | Boolean | whether or not the bounds are equivilant. |
add(x, y) | OpenLayers.Bounds | Shift bounds by x and y. |
contains(x, y, inclusive) | Boolean | Return Whether or not the passed-in coordinates are within this bounds |
containsBounds(bounds, partial, inclusive) | Boolean | Returns 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) | String | Determine which quadrant the LonLat is in. Returns combination of "b" or "t" and "l" or "r". |
Utility class. Stores a bunch of methods and settings that don't fit anywhere else.
Options
OpenLayers.Util.onImageLoadErrorColor | A string to set img.style.backgroundColor to if the onerror event fires for the image (useful for 500 errors from WMS, for example). |
OpenLayers.ImgPath | A string to be used as the base for images for controls and the like. Should end with '/'. |
OpenLayers contains a number of helper functions for working with AJAX.
Methods
OpenLayers.loadURL(uri, params, caller, onComplete, onFailure) | none | This function sends an XMLHTTPRequest to a remote site, specified by URI, with the params string given as the params argument. Caller is bound as 'this' to the function specified by either onComplete or onFailure. |
OpenLayers.parseXMLString(text) | AJAXResponse | Accepts a block of text, and creates a DOM response document from the text. |
Parameters
OpenLayers.ProxyHost | When initiating an AJAX request, any URL that is absolute is prefixed with OpenLayers.ProxyHost. The ProxyHost is designed to accept a URL and return the content, in an effort to work around cross-browser security restrictions. This defaults to null, but if you wish to access content from another domain that Javascript would restrict access to, you must set this to be the URL which will accept a URL encoded version of the passed URL and return the content at that URL. An example is available as proxy.txt in the examples/ directory. |