OpenLayers

The OpenLayers object provides a namespace for all things OpenLayers

Summary
The OpenLayers object provides a namespace for all things OpenLayers
{String} Relative path of this script.
Return the path to this script.
This is the old $() from prototype
Remove an object from an array.
Deprecated.
Seems to exist already in FF, but not in MOZ.
Modifies many properties of a DOM element all at once.
Creates a new div and optionally set some standard attributes.
Creates an img element with specific attribute values.
Deprecated.
Bound to image load events.
{String} The color tiles with load errors will turn.
{Integer} How many times should we try to reload an image before giving up? 
{Boolean} true if the png alpha hack is necessary and possible, false otherwise.
Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.
Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.
Takes an object and copies any properties that don’t exist from another properties, by analogy with OpenLayers.Util.extend() from Prototype.js.
{String} Default is ‘’.
{String} The fully formatted image location string
Execute functions until one of them doesn’t throw an error.
These could/should be made namespace aware?
Given two objects representing points with geographic coordinates, this calculates the distance between those points on the surface of an ellipsoid.
Parse the parameters from a URL or from the current page itself into a JavaScript Object.
Deprecated.
{Integer} The ever-incrementing count variable.
Create a unique identifier for this session.
{Object} Constant inches per unit -- borrowed from MapServer mapscale.c derivation of nautical miles from http://en.wikipedia.org/wiki/Nautical_mile Includes the full set of units supported by CS-MAP (http://trac.osgeo.org/csmap/) and PROJ.4 (http://trac.osgeo.org/proj/) The hardcoded table is maintain in a CS-MAP source code module named CSdataU.c The hardcoded table of PROJ.4 units are in pj_units.c.
{Integer} 72 (A sensible default)
Deprecated.
Calculates the position of an element on the page.
Test two URLs for equivalence.
Takes a url and removes everything after the ?
{String} A string which specifies which is the current browser in which we are running.
Renders the contentHTML offscreen to determine actual dimensions for popup sizing.
The OpenLayers.Console namespace is used for debugging and error logging.
OpenLayers custom string, number and function functions are described here.
Contains convenience functions for string manipulation.
Used to test strings as numbers.
Contains convenience functions for manipulating numbers.
Decimal separator to use when formatting numbers.
Thousands separator to use when formatting numbers.
Contains convenience functions for function manipulation.
Contains convenience functions for array manipulation.
Base class used to construct all other classes.
Deprecated.
Instances of this class represent a width/height pair
Create an instance of OpenLayers.Size
Return the string representation of a size object
Instances of this class represent bounding boxes.
{Number} Minimum horizontal coordinate.
{Number} Minimum vertical coordinate.
{Number} Maximum horizontal coordinate.
{Number} Maximum vertical coordinate.
{OpenLayers.LonLat} A cached center location.
Construct a new bounds object.
Create a cloned instance of this bounds.
Test a two bounds for equivalence.
Scales the bounds around a pixel or lonlat.
Get the opposite quadrant for a given quadrant string.
Tests if an element has the given CSS class name.
Add a CSS class name to an element.
Remove a CSS class name from an element.
Remove a CSS class name from an element if it exists.
This class represents a longitude and latitude pair
Create a new map location.
Return a readable string version of the lonlat
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string
This class represents a screen coordinate, in x and y coordinates
Create a new OpenLayers.Pixel instance
Cast this object into a string
Controls affect the display or behavior of the map.
{String}
{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map
{DOMElement}
{OpenLayers.Control.TYPES} Controls can have a ‘type’.
{Boolean} By deafault, controls do not allow selection, because it may interfere with map dragging.
{string} This property is used for CSS related to the drawing of the Control.
{string} This property is used for showing a tooltip over the Control.
{Boolean} The control is active.
{OpenLayers.Events} Events instance for triggering control specific events.
{Array(String)} Supported application event types.
Create an OpenLayers Control.
The destroy method is used to perform any clean up before the control is dereferenced.
Set the map property for the control.
The draw method is called when the control is ready to be displayed on the page.
Sets the left and top style attributes to the passed in pixel coordinates.
Explicitly activates a control and it’s associated handler if one has been set.
Deactivates a control and it’s associated handler if any.
The icon represents a graphical icon on the screen.
{String} image url
{OpenLayers.Pixel} distance in pixels to offset the image when being rendered
{OpenLayers.Pixel} Function to calculate the offset (based on the size)
{DOMElement}
Creates an icon, which is an image tag in a div.
Nullify references and remove event listeners to prevent circular references and memory leaks
{OpenLayers.Icon} A fresh copy of the icon.
Move the div to the given pixel.
Change the icon’s opacity
move icon to passed in px.
Hide or show the icon
Internationalization namespace.
{String} Current language code to use in OpenLayers.
A popup is a small div that can opened and closed on the map.
{OpenLayers.Events} custom event manager
{String} the unique identifier assigned to this popup.
{OpenLayers.LonLat} the position of this popup on the map
{DOMElement} the div that contains this popup.
{OpenLayers.Size} the width and height of the content.
{OpenLayers.Size} the width and height of the popup.
{String} An HTML string for this popup to display.
{String} the background color used by the popup.
{float} the opacity of this popup (between 0.0 and 1.0)
{String} the border size of the popup.
{DOMElement} a reference to the element that holds the content of the div.
{DOMElement} First and only child of ‘div’.
{DOMElement} the optional closer image
{String} The CSS class of the popup.
{String} The CSS class of the popup content div.
{int or OpenLayers.Bounds} An extra opportunity to specify internal padding of the content div inside the popup.
To be removed in 3.0, this function merely helps us to deal with the case where the user may have set an integer value for padding, instead of an OpenLayers.Bounds object.
{OpenLayers.Map} this gets set in Map.js when the popup is added to the map
Create a popup.
nullify references to prevent circular references and memory leaks
Constructs the elements that make up the popup.
if the popup has a lonlat and its map members set, then have it move itself to its proper position
{Boolean} Boolean indicating whether or not the popup is visible
Toggles visibility of the popup.
Makes the popup visible.
Makes the popup invisible.
Used to adjust the size of the popup.
Sets the background color of the popup.
Sets the opacity of the popup.
Sets the border style of the popup.
Allows the user to set the HTML content of the popup.
Called when an image contained by the popup loaded.
Glorious, oh glorious hack in order to determine the css ‘padding’ of the contentDiv.
Pans the map such that the popup is totaly viewable (if necessary)
Registers events on the popup.
When mouse goes down within the popup, make a note of it locally, and then do not propagate the mousedown (but do so safely so that user can select text inside)
If the drag was started within the popup, then do not propagate the mousemove (but do so safely so that user can select text inside)
When mouse comes up within the popup, after going down in it, reset the flag, and then (once again) do not propagate the event, but do so safely so that user can select text inside
Ignore clicks, but allowing default browser handling
When mouse goes out of the popup set the flag to false so that if they let go and then drag back in, we won’t be confused.
Ignore double-clicks, but allowing default browser handling
This is the base class for all renderers.
{DOMElement}
{Boolean} If the renderer is currently in a state where many things are changing, the ‘locked’ property is set to true.
{Float} cache of current map resolution
{OpenLayers.Map} Reference to the map -- this is set in Vector’s setMap()
Set the visible part of the layer.
Sets the size of the drawing surface.
Uses cached copy of resolution if available to minimize computing
Draw the feature.
Draw a geometry.
Clear all vectors from the renderer.
Returns a feature id from an event on the renderer.
This is called by the layer to erase features
Remove a geometry from the renderer (by id).
The OpenLayers.Request namespace contains convenience methods for working with XMLHttpRequests.
{Object} Default configuration for all requests.
{int} Interval in milliseconds between 2 steps
{int} Step counter
{int} Interval id returned by window.setInterval
{Boolean} Tells if the easing is currently playing
Creates a Tween.
Calls the appropriate easing method
Easing Equations by Robert Penner, http://www.robertpenner.com/easing/
Set the map property for the control.
As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.
As soon as all the layers are loaded, cycle through them and hide or show them.
{Array(DOMElement)} Array of Button Divs
{Integer}
{Integer}
Utility functions for event handling.
{Object} A hashtable cache of the event observers.
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
Cross browser event element detection.
Determine whether event was caused by a left click.
Determine whether event was caused by a right mouse click.
Stops an event from propagating.
Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.
Cycle through all the element entries in the events cache and call stopObservingElement on each.
{Array(String)} supported events
{Object} Hashtable of Array(Function): events listener functions
{Object} the code object issuing application events
{DOMElement} the DOM element receiving browser events
{Array(String)} list of support application events
{Function} bound event handler attached to elements
Construct an OpenLayers.Events object.
Convenience method for registering listeners with a common scope.
Convenience method for unregistering listeners with a common scope.
Remove all listeners for a given event type.
Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.
Base class for format reading/writing a variety of formats.
{Object} A reference to options passed to the constructor.
Instances of this class are not useful.
Read data from a string, and return an object whose type depends on the subclass.
Accept an object, and return a string.
Dictionary for English.
Since the popup is moving to a new px, it might need also to be moved relative to where the marker is.
The popup has been moved to a new relative location, so we may want to make some cosmetic adjustments to it.
Class for coordinate transforms between coordinate systems.
{Object} Proj4js.Proj instance.
{String}
This class offers several methods for interacting with a wrapped pro4js projection object.
Convert projection to string (getCode wrapper).
Test equality of two projection instances.
Destroy projection object.
Transforms is an object, with from properties, each of which may have a to property.
A renderer based on the 2D ‘canvas’ drawing element.element
{DOMElement} root element of canvas.
{Canvas} The canvas context object.
{Object} Internal object of feature/style pairs for use in redrawing the layer.
{Object} Geometry -> Feature lookup table.
Erase a geometry from the renderer.
Set the visible part of the layer.
Sets the size of the drawing surface.
Draw the feature.
Used when looping (in redraw) over the features; draws the canvas.
Called to draw External graphics.
Prepare the canvas for drawing by setting various global settings.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
transform geographic xy into pixel xy
Clear all vectors from the renderer.
Returns a feature id from an event on the renderer.
This is called by the layer to erase features; removes the feature from the list, then redraws the layer.
The real ‘meat’ of the function: any time things have changed, redraw() can be called to loop over all the data and (you guessed it) redraw it.
This class takes care of figuring out which order elements should be placed in the DOM based on given indexing methods.
{Integer} This is the largest-most z-index value for a node contained within the indexer.
{Array<String>} This is an array of node id’s stored in the order that they should show up on screen.
{Object} This is a hash that maps node ids to their z-index value stored in the indexer.
{Function} This is the function used to determine placement of of a new node within the indexer.
Determine the z-index for the current node if there isn’t one, and set the maximum value if we’ve found a new maximum.
These are the compare methods for figuring out where a new node should be placed within the indexer.
This compare method is used by other comparison methods.
This is another virtual class in that it should never be instantiated by itself as a Renderer.
{DOMElement}
{DOMElement}
{String}
{<OpenLayers.ElementIndexer>} An instance of OpenLayers.ElementsIndexer created upon initialization if the zIndexing or yOrdering options passed to this renderer’s constructor are set to true.
{String}
{Object}
Remove all the elements from the root
This function is in charge of asking the specific renderer which type of node to create for the given geometry and style.
Draw the geometry, creating new nodes, setting paths, setting style, setting featureId on the node.
Redraws the node using special ‘background’ style properties.
Given a node, draw a geometry on the specified layer.
Things that have do be done after the geometry node is appended to its parent node.
Virtual function for drawing Point Geometry.
Virtual function for drawing LineString Geometry.
Virtual function for drawing LinearRing Geometry.
Virtual function for drawing Polygon Geometry.
Virtual function for drawing Rectangle Geometry.
Virtual function for drawing Circle Geometry.
Virtual function for drawing Surface Geometry.
Erase a geometry from the renderer.
Create new node of the specified type, with the (optional) specified id.
Determines if a symbol cannot be rendered using drawCircle
Coordinate arrays for well known (named) symbols.
Standard-compliant (W3C) cross-browser implementation of the XMLHttpRequest object.
This is a class designed to designate a single tile, however it is explicitly designed to do relatively little.
{Array(String)} Supported application event types
{String} null
{OpenLayers.Layer} layer the tile is attached to
{String} url of the request.
{OpenLayers.Pixel} Top Left pixel of the tile
{Boolean} Is the tile loading?
Constructor for a new OpenLayers.Tile instance.
Call immediately before destroying if you are listening to tile events, so that counters are properly handled if tile is still loading at destroy-time.
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.
Reposition the tile.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.
Show the tile only if it should be drawn.
Show the tile.
Hide the tile.
@param {} request
Parse XML into a doc structure
{Object} Transport mechanism for whichever browser we’re in, or false if none available.
{Integer}
{Object}
{Array}
Deprecated.
{Boolean}
{Boolean} -
If the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.
{Array(String)}
{Integer}
{String}
Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.
Base class to construct a higher-level handler for event sequences.
{String}
{Boolean}
{Event} This property references the last event handled by the handler.
Construct a handler.
Check the keyMask on the handler.
Trigger the control’s named callback with the given arguments
register an event on the map
unregister an event from the map
With each registered browser event, the handler sets its own evt property.
Deconstruct the handler.
If set as the <keyMask>, checkModifiers returns false if any key is down.
If set as the <keyMask>, checkModifiers returns false if Shift is down.
If set as the <keyMask>, checkModifiers returns false if Ctrl is down.
If set as the <keyMask>, checkModifiers returns false if Alt is down.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
{Object} Base z-indexes for different classes of thing
{Array(String)} Supported application event types.
{String} Unique identifier for the map
{Boolean} For a base layer that supports it, allow the map resolution to be set to a value between one of the values in the resolutions array.
{Boolean} The map is currently being dragged.
{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.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
{Float} The resolution of the map.
{Integer} The current zoom level of the map
{Float} The ratio of the current extent within which panning will tween.
{String} Used to store a unique identifier that changes when the map view changes.
{OpenLayers.Tween} Animated panning tween object, see panTo()
{Function} The Easing function to be used for tweening.
{OpenLayers.Bounds} Outside margin of the popup.
Constructor for a new OpenLayers.Map instance.
Function that is called to destroy the map on page unload.
When the map is destroyed, we need to stop listening to updateSize events: this method stores the function we need to unregister in non-IE browsers.
Reset each layer’s z-index based on layer’s array index
{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div
This function takes care to recenter the layerContainerDiv.
{Integer} 256 Default tile width (unless otherwise specified)
{Integer} 256 Default tile height (unless otherwise specified)
Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.
{OpenLayers.Icon} The icon used by this marker.
{OpenLayers.LonLat} location of object
{OpenLayers.Events} the event handler.
{OpenLayers.Map} the map this marker is attached to
Calls draw on the icon, and returns that output.
Move the marker to the new location.
{Boolean} Whether or not the marker is currently visible on screen.
Englarges the markers icon by the specified ratio.
Change the opacity of the marker by changin the opacity of its icon
Change URL of the Icon Image.
Hide or show the icon
Creates a default OpenLayers.Icon.
{Boolean} Has the popup been rounded yet?
The popup has been moved to a new relative location, in which case we will want to re-do the rico corners.
Always sets border to 0.
Update RICO corners according to the popup’s current relative postion.
{String} The proper corners string (“tr tl bl br”) for rico to round.
{Integer} 5.
{String}
{String}
{Integer} Firefox has a limitation where values larger or smaller than about 15000 in an SVG document lock the browser up.
{Object} Hash with “x” and “y” properties
{Object} Cache for symbol sizes according to their svg coordinate space
See #669 for more information
Transforms the SVG coordinate system
Sets the size of the drawing surface.
Use to set all the style attributes to a SVG node.
{DOMElement} The specific render engine’s root element
{DOMElement} The main root element to which we’ll add vectors
{DOMElement} The element to which we’ll add the symbol definitions
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
Given two points (one inside the valid range, and one outside), clips the line betweeen the two points so that the new points are both inside the valid range.
Finds the position of an svg node.
add a new symbol definition from the rendererer’s symbol hash
Render vector features in browsers with VML capability.
{String} XML Namespace URN
{DOMElement} node holding symbols.
{Object} Hash with “x” and “y” properties
Create a new VML renderer.
Set the renderer’s extent
Set the size of the drawing surface
Get the node type for a geometry and style
Use to set all the style attributes to a VML node.
If a point is to be styled with externalGraphic and rotation, VML fills cannot be used to display the graphic, because rotation of graphic fills is not supported by the VML implementation of Internet Explorer.
Some versions of Internet Explorer seem to be unable to set fillcolor and strokecolor to “none” correctly before the fill node is appended to a visible vml node.
Get the geometry’s bounds, convert it to our vml coordinate system, then set the node’s position, size, and local coordinate system.
Create a new node
Determine whether a node is of a given type
Create the renderer root
Create the main root element
Render a point
Render a circle.
Render a linestring.
Render a linearring
Render a line.
Render a polygon
Render a rectangle
add a new symbol definition from the rendererer’s symbol hash
Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.
{String} The URL of the image being requested.
{DOMElement} The div element which wraps the image.
{DOMElement} The image element is appended to the frame.
{Boolean} True if the png alpha hack needs to be applied on the layer’s div.
{Boolean} Is this tile a back buffer tile?
{Float} Used in transition code only.
{Boolean} Is this the first time the tile is being drawn? 
{OpenLayers.Tile} A clone of the tile used to create transition effects when the tile is moved or changes resolution.
Constructor for a new OpenLayers.Tile.Image instance.
Check that a tile should be drawn, and draw it.
Triggered by two different events, layer loadend, and tile loadend.
Internal function to actually initialize the image tile, position it correctly, and set its url.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Creates the imgDiv property on the tile.
Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.
This method is invoked on tiles that are backBuffers for tiles in the grid.
Show the tile by showing its frame.
Hide the tile by hiding its frame.
Create an overview map to display the extent of your main map and provide additional navigation control.
{DOMElement} The DOM element that contains the overview map
{Object}
{Object}
Create a new overview map
Render the control in the browser.
Handle extent rectangle drag
Handle browser events
Unhide the control.
Hide all the contents of the control, shrink the size, add the maximize icon
Hide/Show the toggle depending on whether the control is minimized
Update the overview map after layers move.
Determines if the overview map is suitable given the extent and resolution of the main map.
Construct the map that this control contains
Updates the extent rectangle position and size to match the map extent
Updates the map extent to match the extent rectangle position and size
Set extent rectangle pixel bounds.
Get the rect bounds from the map bounds.
Get the map bounds from the rect bounds.
Get a map location from a pixel location
Get a pixel location from a map location
Features are combinations of geography and attributes.
{String}
{Object}
Constructor for features.
nullify references to prevent circular references and memory leaks
{Boolean} Whether or not the feature is currently visible on screen (based on its ‘lonlat’ property)
Based on the data associated with the Feature, create and return a marker object.
Destroys marker.
Creates a popup object created from the ‘lonlat’, ‘popupSize’, and ‘popupContentHTML’ properties set in this.data.
Destroys the popup created via createPopup.
A handler for mouse clicks.
{Number} The id of the timeout waiting to clear the delayedCall.
{OpenLayers.Pixel} The pixel location of the last mousedown.
{Number} The id of the right mouse timeout waiting to clear the <delayedEvent>.
Create a new click handler.
Handle mousedown.
Handle mouseup.
Handle rightclick.
Sets rightclickTimerId to null.
Handle dblclick.
Handle click.
Determine whether the event is within the optional pixel tolerance.
Clear the timer and set timerId to null.
Sets timerId to null.
The drag handler is used to deal with sequences of browser events related to dragging.
{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.
{Boolean} Stop propagation of mousedown events from getting to listeners on the same element.
{Boolean}
{OpenLayers.Pixel} The last pixel location of the drag.
{OpenLayers.Pixel} The first pixel location of the drag.
{Function}
{Integer} In order to increase performance, an interval (in milliseconds) can be set to reduce the number of drag events called.
{String} The id of the timeout used for the mousedown interval.
Returns OpenLayers.Handler.Drag
This method is called during the handling of the mouse down event.
This method is called during the handling of the mouse move event.
This method is called during the handling of the mouse up event.
This method is called during the handling of the mouse out event.
Handle mousedown events
Handle mousemove events
Private.
Handle mouseup events
Handle mouseout events
The drag handler captures the click event.
Activate the handler.
Deactivate the handler.
Handler to respond to mouse events related to a drawn feature.
{Object} A object mapping the browser events to objects with callback keys for in and out.
{OpenLayers.Feature.Vector} The last feature that was hovered.
{OpenLayers.Feature.Vector} The last feature that was handled.
{OpenLayers.Pixel} The location of the last mousedown.
{OpenLayers.Pixel} The location of the last mouseup.
{Number} The number of pixels the mouse can move during a click that still constitutes a click out.
To restrict dragging to a limited set of geometry types, send a list of strings corresponding to the geometry class names.
{Boolean} If stopClick is set to true, handled clicks do not propagate to other click listeners.
{Boolean} If stopDown is set to true, handled mousedowns do not propagate to other mousedown listeners.
{Boolean} If stopUp is set to true, handled mouseups do not propagate to other mouseup listeners.
Handle mouse down.
Handle mouse up.
Handle click.
Handle mouse moves.
Handle dblclick.
Return true if the geometry type of the passed feature matches one of the geometry types in the geometryTypes array.
Call the callback keyed in the event map with the supplied arguments.
Turn on the handler.
Turn off the handler.
Moves the layer for this handler to the top, so mouse events can reach it.
Moves the layer back to the position determined by the map’s layers array.
The hover handler is to be used to emulate mouseovers on objects on the map that aren’t DOM elements.
{OpenLayers.Pixel} The location of the last mousemove, expressed in pixels.
{Number} The id of the timer.
Construct a hover handler.
Called when the mouse moves on the map.
Called when the mouse goes out of the map.
Determine whether the mouse move is within the optional pixel tolerance.
Clear the timer and set timerId to null.
Triggers pause callback.
Handler for wheel up/down events.
{function}
{OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove.
Catch the wheel event and handle it xbrowserly
Given the wheel event, we carry out the appropriate zooming in or out, based on the ‘wheelDelta’ or ‘detail’ property of the event.
Update the stored mousePosition on every move.
{Float} The layer’s opacity.
{Array(String)} Supported application event types.
{Boolean} The layer’s images have an alpha channel.
{Boolean} The current map resolution is within the layer’s min/max range.
{OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter.
{Object} An optional object whose properties will be set on the layer.
{Array} An immutable (that means don’t change it!)
Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own.
Set the map property for the layer.
{Boolean} The layer is displayable at the current map’s current resolution.
This method’s responsibility is to set up the ‘resolutions’ array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.
Calculates the max extent which includes all of the data for the layer.
{Integer} the z-index of this layer
This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world.
{DOMElement}
Allow the user to change the box’s color and border width
{Boolean} Whether or not the marker is currently visible on screen.
Hide or show the icon
DragPan control.
{OpenLayers.Control.TYPES}
{Boolean} The map moved.
{Integer} The number of milliseconds that should ellapse before panning the map again.
Creates a Drag handler, using panMap and panMapDone as callbacks.
Finish the panning operation.
Vector features use the OpenLayers.Geometry classes as geometry description.
{String}
{String}
{String} rendering intent currently being used
Create a vector feature.
nullify references to prevent circular references and memory leaks
Create a clone of this vector feature.
Determine whether the feature is within the map viewport.
Determins whether the feature intersects with the specified location.
Moves the feature and redraws it at its new location
Sets the new state
OpenLayers features can have a number of style attributes.
Handler for dragging a rectangle across the map.
{Object} Caches some box characteristics from css.
Remove the zoombox from the screen and nullify our reference to it.
Handler to draw a regular polygon on the map.
{Float} The angle from the origin (mouse down) to the current mouse position, in radians.
{Boolean} The polygon has a fixed radius.
{OpenLayers.Feature.Vector} The currently drawn polygon feature
{OpenLayers.Layer.Vector} The temporary drawing layer
{OpenLayers.Geometry.Point} Location of the first mouse down
Create a new regular polygon handler.
Start drawing a new feature
Respond to drag move events
Finish drawing the feature
Finish drawing the feature.
Create the new polygon geometry.
Modify the polygon geometry in place.
Calculate the angle based on settings.
Finish the geometry and call the “done” callback.
Trigger the control’s named callback with the given arguments
Base class for 3rd party layers.
{Boolean} EventPaned layers are always base layers, by necessity.
{DOMElement} A reference to the element that controls the events.
{Object} This is the object which will be used to load the 3rd party library in the case of the google layer, this will be of type GMap, in the case of the ve layer, this will be of type VEMap
Create a new event pane layer
Set the map property for the layer.
If we can’t load the map lib, then display an error message to the user and tell them where to go for help.
To be implemented by subclasses.
Set the display on the pane
Set the z-index order for the pane.
Handle calls to move the layer.
Get a map location from a pixel location
Get a pixel location from a map location
Get an OL style map location from a 3rd party style map location
Get a 3rd party map location from an OL map location.
Get an OL pixel location from a 3rd party pixel location.
Get a 3rd party pixel location from an OL pixel location
Some Layers will already have established zoom levels (like google or ve).
Create a new fixed zoom levels layer.
Populate the resolutions array
Get the zoom level for a given resolution
Get the OL zoom index from the map object zoom level
Get the map object zoom level from the OL zoom level
{Float} Used to hash URL param strings for multi-WMS server selection.
{Array(String) or String} This is either an array of url strings or a single url string.
{Object} Hashtable of key/value parameters
selectUrl() implements the standard floating-point multiplicative hash function described by Knuth, and hashes the contents of the given param string into a float between 0 and 1.
Combine url with layer’s params and these newParams.
{Array(OpenLayers.Marker)} internal marker list
{Boolean} internal state of drawing.
Create a Markers layer.
This method removes all markers from a layer.
Calculate the pixel location for the marker, create it, and add it to the layer’s div
A mixin for layers that wraps up the pieces neccesary to have a coordinate conversion for working with commercial APIs which use a spherical mercator projection.
Get the map’s extent.
Set up the mercator parameters on the layer: resolutions, projection, units.
Given an object with x and y properties in EPSG:4326, modify the x,y properties on the object to be the Spherical Mercator projected coordinates.
Given an object with x and y properties in Spherical Mercator, modify the x,y properties on the object to be the unprojected coordinates.
Transforms from EPSG:4326 to EPSG:900913 and from EPSG:900913 to EPSG:4326 are set by this class.
Draws features on a vector layer when active.
{Object} The functions that are sent to the handler for callback
Allows for drawing of features for measurements.
{Array(String)} Supported application event types.
{Object} The functions that are sent to the handler for callback
{String} Display system for output measurements.
{Object} Units for various measurement systems.
Called when the measurement sketch is done.
Called each time a new point is added to the measurement sketch.
Based on the displaySystem returns the area of a geometry.
Based on the displaySystem returns the length of a geometry.
{OpenLayers.Control.TYPE}
{Boolean} Should the control be used for zooming out?
Class for reading and writing Well-Known Text.
Create a new parser for WKT
Deserialize a WKT string and return a vector feature or an array of vector features.
Serialize a feature or array of features into a WKT string.
{Integer} 0
{Integer} 19
{Array(Float)} Hardcode these resolutions so that they are more closely tied with the standard wms projection
{GDraggableObject} Since 2.93, Google has exposed the ability to get the maps GDraggableObject.
Load the GMap and register appropriate event listeners.
The map has been centered, and a map type was specified, so we set the map type on the gmap object, then unregister the listener so that we dont keep doing this every time the map moves.
Hide or show the layer
Hack-on function because GMAPS does not give it to us
Base class for layers that use a lattice of tiles.
{Array(Array(OpenLayers.Tile))} This is an array of rows, each row is an array of tiles.
Create a new grid layer
Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references
This function is called whenever the map is moved.
Deprecated.
Generate parameters for the grid layout.
Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue.
This function takes a tile as input and adds the appropriate hooks to the tile so that the layer can keep track of the loading tiles.
This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks()
Shifty grid work
Shift grid work in the other dimension
When the size of the map or the buffer changes, we may need to remove some excess rows and columns.
For singleTile layers, this will set a new tile size according to the dimensions of the map pane.
This class represents a UserStyle obtained from a SLD, containing styling rules.
{String} Title of this style (set if included in SLD)
{String} Description of this style (set if abstract is included in SLD)
{Object} An optional object with properties that symbolizers’ property values should be evaluated against.
{Object} hash of style properties to use as default for merging rule-based style symbolizers onto.
{Hash of Boolean} cache of style properties that need to be parsed for propertyNames.
Creates a UserStyle.
creates a style by applying all feature-dependent rules to the base style.
creates literals for all style properties that have an entry in <this.propertyStyles>.
Looks into all rules for this style and the defaultStyle to collect all the style hash property names containing ${...}
Returns the correct symbolizer prefix according to the geometry type of the passed geometry
converts a style value holding a combination of PropertyName and Literal into a Literal, taking the property values from the passed features.
{Array} prefixes of the sld symbolizers.
The navigation control handles map browsing with mouse events (dragging, double-clicking, and scrolling the wheel).
Create a new navigation control
The destroy method is used to perform any clean up before the control is dereferenced.
User spun scroll wheel up
User spun scroll wheel down
A Geometry is a description of a geographic object.
{String} A unique identifier for this geometry.
{OpenLayers.Geometry}This is set when a Geometry is added as component of another geometry
{OpenLayers.Bounds} The bounds of this geometry
Creates a geometry object.
Destroy this geometry.
Nullify this components bounds and that of its parent as well.
Extend the existing bounds to include the new bounds.
Calculate the length of this geometry.
Calculate the area of this geometry.
Returns the Well-Known Text representation of a geometry
Determine whether two line segments intersect.
Instances of OpenLayers.Layer.MapGuide are used to display data from a MapGuide OS instance.
{Object} Hashtable of default parameter key/value pairs for tiled layer
{Object} Hashtable of default parameter key/value pairs for untiled layer
{Object} Hashtable of default parameter key/value pairs for untiled layer
{OpenLayers.Size} Tile size as produced by MapGuide server
Create a new Mapguide layer, either tiled or untiled.
factor that are different than the defaults used in OpenLayers, so these must be adjusted accordingly in your application.
Create a clone of this layer
Creates a tile, initializes it, and adds it to the layer div.
Return a query string for this layer
getFullRequestString on MapGuide layers is special, because we do a regular expression replace on ‘,’ in parameters to ‘+’.
Generate parameters for the grid layout.
Instances of OpenLayers.Layer.MapServer are used to display data from a MapServer CGI instance.
{Object} Hashtable of default parameter key/value pairs
Create a new MapServer layer object
Create a clone of this layer
Creates a tile, initializes it, and adds it to the layer div.
Return a query string for this layer
combine the layer’s url with its params and these newParams.
Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.
{Object} Hashtable of default parameter key/value pairs
Deprecated.
Create a new WMS layer object
Destroy this layer
Create a clone of this layer
Return a GetMap query string for this layer
addTile creates a tile, initializes it, and adds it to the layer div.
This class represents an SLD Rule, as being used for rule-based SLD styling.
{String} A unique id for this session.
{String} Title of this rule (set if included in SLD)
{String} Description of this rule (set if abstract is included in SLD)
{Object} An optional object with properties that the rule should be evaluated against.
{<OpenLayers.Filter>} Optional filter for the rule.
{Boolean} Determines whether this rule is only to be applied only if no other rules match (ElseFilter according to the SLD specification).
{Object} Symbolizer or hash of symbolizers for this rule.
Creates a Rule.
Gets the context for evaluating this rule
Hash of {OpenLayers.Style}, keyed by names of well known rendering intents (e.g.
{Boolean} if true, every render intent will extend the symbolizers specified for the “default” intent at rendering time.
Creates the symbolizer for a feature for a render intent.
Convenience method to create comparison rules for unique values of a property.
A Collection is exactly what it sounds like: A collection of different Geometries.
{Array(String)} An array of class names representing the types of components that the collection can include.
Creates a Geometry Collection -- a list of geoms.
Get a string representing the components for this collection
Add a new component (geometry) to the collection.
Remove a component from this geometry.
Point geometry class.
Construct a point geometry.
Create a new Bounds based on the lon/lat
{String} Shortened String representation of Point object.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
{Array(String)} Supported application event types.
{Object} hash of features, keyed by feature.id, that the renderer failed to draw
{Array(<OpenLayers.Strategy>})} Optional list of strategies for the layer.
{<OpenLayers.Protocol>} Optional protocol for the layer.
{Array(String)} List of supported Renderer classes.
{Boolean} Whether the Vector Layer features have been drawn yet.
Create a new vector layer
Ask the layer to request features again and redraw them.
Iterates through the available renderer implementations and selects and assigns the first one whose “supported()” function returns true.
Let the user know their browser isn’t supported.
The layer has been added to the map.
The layer has been removed from the map.
Notify the renderer of the change in size.
Reset the vector layer’s div so that it once again is lined up with the map.
Erase features from the layer.
Given an event, return a feature if the event occurred over one.
MultiPoint is a collection of Points.
{Array(String)} An array of class names representing the types of components that the collection can include.
Create a new MultiPoint Geometry
Handler to draw a point on the map.
{OpenLayers.Feature.Vector} The currently drawn point
{OpenLayers.Layer.Vector} The temporary drawing layer
{Boolean} Cast features to multi-part geometries before passing to the layer.
{Boolean} A point is being drawn
{Boolean} The mouse is down
{OpenLayers.Pixel} Location of the last mouse down
{Object} Any optional properties to be set on the sketch layer.
Create a new point handler.
Add temporary features
Destroy the temporary geometries
Finish the geometry and call the “done” callback.
Handle clicks.
Handle double-clicks.
Render features on the temporary layer.
Return the sketch geometry.
Return a clone of the relevant geometry.
Handle mouse down.
Handle mouse move.
Handle mouse up.
A Curve is a MultiPoint, whose points are assumed to be connected.
{Array(String)} An array of class names representing the types of components that the collection can include.
A LineString is a Curve which, once two points have been added to it, can never be less than two points long.
Create a new LineString geometry
{Array} An array of segment objects.
A Linear Ring is a special LineString which is closed.
{Array(String)} An array of class names representing the types of components that the collection can include.
Linear rings are constructed with an array of points.
Test if a point is inside a linear ring.
Handler to draw a path on the map.
{Boolean} In freehand mode, the handler starts the path on mouse down, adds a point for every mouse move, and finishes the path on mouse up.
{String} If set, freehandToggle is checked on mouse events and will set the freehand mode to the opposite of this.freehand.
Create a new path hander
Add temporary geometries
Destroy temporary geometries
Destroy the temporary point.
Add point to geometry.
Determine whether to behave in freehand mode or not.
Modify the existing geometry given the new point
Render geometries on the temporary layer.
Return the sketch geometry.
Handle mouse down.
Handle mouse move.
Handle mouse up.
Handle double-clicks.
Polygon is a collection of Geometry.LinearRings.
{Array(String)} An array of class names representing the types of components that the collection can include.
Constructor for a Polygon geometry.
Test if a point is inside a polygon.
Handler to draw a polygon on the map.
Create a Polygon Handler.
Add temporary geometries
Destroy temporary geometries
Modify the existing geometry given the new point
Render geometries on the temporary layer.
Return the sketch geometry.
Handle double-clicks.

Properties

_scriptName

{String} Relative path of this script.

Functions

_getScriptLocation

_getScriptLocation: function ()

Return the path to this script.

Returns

{String} Path to this script

Constants

VERSION_NUMBER

Util

Summary
This is the old $() from prototype
Remove an object from an array.
Deprecated.
Seems to exist already in FF, but not in MOZ.
Modifies many properties of a DOM element all at once.
Creates a new div and optionally set some standard attributes.
Creates an img element with specific attribute values.
Deprecated.
Bound to image load events.
{String} The color tiles with load errors will turn.
{Integer} How many times should we try to reload an image before giving up? 
{Boolean} true if the png alpha hack is necessary and possible, false otherwise.
Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.
Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.
Takes an object and copies any properties that don’t exist from another properties, by analogy with OpenLayers.Util.extend() from Prototype.js.
{String} Default is ‘’.
{String} The fully formatted image location string
Execute functions until one of them doesn’t throw an error.
These could/should be made namespace aware?
Given two objects representing points with geographic coordinates, this calculates the distance between those points on the surface of an ellipsoid.
Parse the parameters from a URL or from the current page itself into a JavaScript Object.
Deprecated.
{Integer} The ever-incrementing count variable.
Create a unique identifier for this session.
{Object} Constant inches per unit -- borrowed from MapServer mapscale.c derivation of nautical miles from http://en.wikipedia.org/wiki/Nautical_mile Includes the full set of units supported by CS-MAP (http://trac.osgeo.org/csmap/) and PROJ.4 (http://trac.osgeo.org/proj/) The hardcoded table is maintain in a CS-MAP source code module named CSdataU.c The hardcoded table of PROJ.4 units are in pj_units.c.
{Integer} 72 (A sensible default)
Deprecated.
Calculates the position of an element on the page.
Test two URLs for equivalence.
Takes a url and removes everything after the ?
{String} A string which specifies which is the current browser in which we are running.
Renders the contentHTML offscreen to determine actual dimensions for popup sizing.

Functions and Properties

getElement

OpenLayers.Util.getElement = function()

This is the old $() from prototype

removeItem

OpenLayers.Util.removeItem = function(array,
item)

Remove an object from an array.  Iterates through the array to find the item, then removes it.

Parameters

array{Array}
item{Object}

Return {Array} A reference to the array

clearArray

OpenLayers.Util.clearArray = function(array)

Deprecated.  This function will disappear in 3.0.  Please use “array.length = 0” instead.

Parameters

array{Array}

indexOf

OpenLayers.Util.indexOf = function(array,
obj)

Seems to exist already in FF, but not in MOZ.

Parameters

array{Array}
obj{Object}

Returns

{Integer} The index at, which the object was found in the array.  If not found, returns -1.

modifyDOMElement

OpenLayers.Util.modifyDOMElement = function(element,
id,
px,
sz,
position,
border,
overflow,
opacity)

Modifies many properties of a DOM element all at once.  Passing in null to an individual parameter will avoid setting the attribute.

Parameters

id{String} The element id attribute to set.
px{OpenLayers.Pixel} The left and top style position.
sz{OpenLayers.Size} The width and height style attributes.
position{String} The position attribute.  eg: absolute, relative, etc.
border{String} The style.border attribute.  eg: solid black 2px
overflow{String} The style.overview attribute.
opacity{Float} Fractional value (0.0 - 1.0)

createDiv

OpenLayers.Util.createDiv = function(id,
px,
sz,
imgURL,
position,
border,
overflow,
opacity)

Creates a new div and optionally set some standard attributes.  Null may be passed to each parameter if you do not wish to set a particular attribute.  Note - zIndex is NOT set on the resulting div.

Parameters

id{String} An identifier for this element.  If no id is passed an identifier will be created automatically.
px{OpenLayers.Pixel} The element left and top position.
sz{OpenLayers.Size} The element width and height.
imgURL{String} A url pointing to an image to use as a background image.
position{String} The style.position value. eg: absolute, relative etc.
border{String} The the style.border value. eg: 2px solid black
overflow{String} The style.overflow value.  Eg. hidden
opacity{Float} Fractional value (0.0 - 1.0)

Returns

{DOMElement} A DOM Div created with the specified attributes.

createImage

OpenLayers.Util.createImage = function(id,
px,
sz,
imgURL,
position,
border,
opacity,
delayDisplay)

Creates an img element with specific attribute values.

Parameters

id{String} The id field for the img.  If none assigned one will be automatically generated.
px{OpenLayers.Pixel} The left and top positions.
sz{OpenLayers.Size} The style.width and style.height values.
imgURL{String} The url to use as the image source.
position{String} The style.position value.
border{String} The border to place around the image.
opacity{Float} Fractional value (0.0 - 1.0)
delayDisplay{Boolean} If true waits until the image has been loaded.

Returns

{DOMElement} A DOM Image created with the specified attributes.

setOpacity

OpenLayers.Util.setOpacity = function(element,
opacity)

Deprecated.  This function has been deprecated.  Instead, please use <OpenLayers.Util.modifyDOMElement> or <OpenLayers.Util.modifyAlphaImageDiv>

Set the opacity of a DOM Element Note that for this function to work in IE, elements must “have layout” according to: http://msdn.microsoft.com- /workshop- /author- /dhtml- /reference- /properties- /haslayout.asp

Parameters

element{DOMElement} Set the opacity on this DOM element
opacity{Float} Opacity value (0.0 - 1.0)

onImageLoad

OpenLayers.Util.onImageLoad = function()

Bound to image load events.  For all images created with createImage or createAlphaImageDiv, this function will be bound to the load event.

onImageLoadErrorColor

{String} The color tiles with load errors will turn.  Default is “pink”

IMAGE_RELOAD_ATTEMPTS

{Integer} How many times should we try to reload an image before giving up?  Default is 0

onImageLoadError

OpenLayers.Util.onImageLoadError = function()

alphaHackNeeded

{Boolean} true if the png alpha hack is necessary and possible, false otherwise.

alphaHack

OpenLayers.Util.alphaHack = function()

Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.

Returns

{Boolean} true if the png alpha hack is necessary and possible, false otherwise.

modifyAlphaImageDiv

OpenLayers.Util.modifyAlphaImageDiv = function(div,
id,
px,
sz,
imgURL,
position,
border,
sizing,
opacity)
div{DOMElement} Div containing Alpha-adjusted Image
id{String}
px{OpenLayers.Pixel}
sz{OpenLayers.Size}
imgURL{String}
position{String}
border{String} sizing {String} ‘crop’, ‘scale’, or ‘image’.  Default is “scale”
opacity{Float} Fractional value (0.0 - 1.0)

createAlphaImageDiv

OpenLayers.Util.createAlphaImageDiv = function(id,
px,
sz,
imgURL,
position,
border,
sizing,
opacity,
delayDisplay)
id{String}
px{OpenLayers.Pixel}
sz{OpenLayers.Size}
imgURL{String}
position{String}
border{String}
sizing{String} ‘crop’, ‘scale’, or ‘image’.  Default is “scale”
opacity{Float} Fractional value (0.0 - 1.0)
delayDisplay{Boolean} If true waits until the image has been loaded.

Returns

{DOMElement} A DOM Div created with a DOM Image inside it.  If the hack is needed for transparency in IE, it is added.

upperCaseObject

OpenLayers.Util.upperCaseObject = function (object)

Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.

Parameters

object{Object}

Returns

{Object} A new Object with all the same keys but uppercased

applyDefaults

OpenLayers.Util.applyDefaults = function (to,
from)

Takes an object and copies any properties that don’t exist from another properties, by analogy with OpenLayers.Util.extend() from Prototype.js.

Parameters

to{Object} The destination object.
from{Object} The source object.  Any properties of this object that are undefined in the to object will be set on the to object.

Returns

{Object} A reference to the to object.  Note that the to argument is modified in place and returned by this function.

getParameterString

OpenLayers.Util.getParameterString = function(params)

Parameters

params{Object}

Returns

{String} A concatenation of the properties of an object in http parameter notation.  (ex.  <i>”key1=value1&key2=value2&key3=value3”</i>) If a parameter is actually a list, that parameter will then be set to a comma-seperated list of values (foo,bar) instead of being URL escaped (foo%3Abar).

ImgPath

{String} Default is ‘’.

getImagesLocation

OpenLayers.Util.getImagesLocation = function()

Returns

{String} The fully formatted image location string

Try

OpenLayers.Util.Try = function()

Execute functions until one of them doesn’t throw an error.  Capitalized because “try” is a reserved word in JavaScript.  Taken directly from OpenLayers.Util.Try()

Parameters

[*]{Function} Any number of parameters may be passed to Try() It will attempt to execute each of them until one of them successfully executes.  If none executes successfully, returns null.

Returns

{*} The value returned by the first successfully executed function.

getNodes

OpenLayers.Util.getNodes=function(p,
tagName)

These could/should be made namespace aware?

Parameters

p{}
tagName{String}

Returns

{Array}

_getNodes

OpenLayers.Util._getNodes=function(nodes,
tagName)

Parameters

nodes{Array}
tagName{String}

Returns

{Array}

getTagText

OpenLayers.Util.getTagText = function (parent,
item,
index)

Parameters

parent{}
item{String}
index{Integer}

Returns

{String}

getXmlNodeValue

OpenLayers.Util.getXmlNodeValue = function(node)

Parameters

node{XMLNode}

Returns

{String} The text value of the given node, without breaking in firefox or IE

mouseLeft

OpenLayers.Util.mouseLeft = function (evt,
div)

Parameters

evt{Event}
div{HTMLDivElement}

Returns

{Boolean}

rad

OpenLayers.Util.rad = function(x)

Parameters

x{Float}

Returns

{Float}

distVincenty

OpenLayers.Util.distVincenty=function(p1,
p2)

Given two objects representing points with geographic coordinates, this calculates the distance between those points on the surface of an ellipsoid.

Parameters

p1{OpenLayers.LonLat} (or any object with both .lat, .lon properties)
p2{OpenLayers.LonLat} (or any object with both .lat, .lon properties)

Returns

{Float} The distance (in km) between the two input points as measured on an ellipsoid.  Note that the input point objects must be in geographic coordinates (decimal degrees) and the return distance is in kilometers.

getParameters

OpenLayers.Util.getParameters = function(url)

Parse the parameters from a URL or from the current page itself into a JavaScript Object.  Note that parameter values with commas are separated out into an Array.

Parameters

url{String} Optional url used to extract the query string.  If null, query string is taken from page location.

Returns

{Object} An object of key/value pairs from the query string.

getArgs

OpenLayers.Util.getArgs = function(url)

Deprecated.  Will be removed in 3.0.  Please use instead <OpenLayers.Util.getParameters>

Parameters

url{String} Optional url used to extract the query string.  If null, query string is taken from page location.

Returns

{Object} An object of key/value pairs from the query string.

lastSeqID

{Integer} The ever-incrementing count variable.  Used for generating unique ids.

createUniqueID

OpenLayers.Util.createUniqueID = function(prefix)

Create a unique identifier for this session.  Each time this function is called, a counter is incremented.  The return will be the optional prefix (defaults to “id_”) appended with the counter value.

Parameters

prefix {String} Optionsal string to prefix unique id.  Default is “id_”.

Returns

{String} A unique id string, built on the passed in prefix.

Constants

INCHES_PER_UNIT

{Object} Constant inches per unit -- borrowed from MapServer mapscale.c derivation of nautical miles from http://en.wikipedia.org/wiki/Nautical_mile Includes the full set of units supported by CS-MAP (http://trac.osgeo.org/csmap/) and PROJ.4 (http://trac.osgeo.org/proj/) The hardcoded table is maintain in a CS-MAP source code module named CSdataU.c The hardcoded table of PROJ.4 units are in pj_units.c.

DOTS_PER_INCH

{Integer} 72 (A sensible default)

Functions

normalzeScale

Parameters

scale{float}

Returns

{Float} A normalized scale value, in 1 / X format.  This means that if a value less than one ( already 1/x) is passed in, it just returns scale directly.  Otherwise, it returns 1 / scale

getResolutionFromScale

OpenLayers.Util.getResolutionFromScale = function (scale,
units)

Parameters

scale{Float}
units{String} Index into OpenLayers.INCHES_PER_UNIT hashtable.  Default is degrees

Returns

{Float} The corresponding resolution given passed-in scale and unit parameters.

getScaleFromResolution

OpenLayers.Util.getScaleFromResolution = function (resolution,
units)

Parameters

resolution{Float}
units{String} Index into OpenLayers.INCHES_PER_UNIT hashtable.  Default is degrees

Returns

{Float} The corresponding scale given passed-in resolution and unit parameters.

safeStopPropagation

OpenLayers.Util.safeStopPropagation = function(evt)

Deprecated.  This function has been deprecated.  Please use directly OpenLayers.Event.stop passing ‘true’ as the 2nd argument (preventDefault)

Safely stop the propagation of an event without preventing the default browser action from occurring.

Parameter

evt{Event}

pagePositon

Calculates the position of an element on the page.

Parameters

forElement{DOMElement}

Returns

{Array} two item array, L value then T value.

isEquivalentUrl

OpenLayers.Util.isEquivalentUrl = function(url1,
url2,
options)

Test two URLs for equivalence.

Setting ‘ignoreCase’ allows for case-independent comparison.

Comparison is based on

  • Protocol
  • Host (evaluated without the port)
  • Port (set ‘ignorePort80’ to ignore “80” values)
  • Hash ( set ‘ignoreHash’ to disable)
  • Pathname (for relative <-> absolute comparison)
  • Arguments (so they can be out of order)

Parameters

url1{String}
url2{String}
options{Object} Allows for customization of comparison:
’ignoreCase’Default is True
’ignorePort80’Default is True
’ignoreHash’Default is True

Returns

{Boolean} Whether or not the two URLs are equivalent

createUrlObject

OpenLayers.Util.createUrlObject = function(url,
options)

Parameters

url{String}
options{Object} A hash of options.  Can be one of: ignoreCase: lowercase url, ignorePort80: don’t include explicit port if port is 80, ignoreHash: Don’t include part of url after the hash (#).

Returns

{Object} An object with separate url, a, port, host, and args parsed out and ready for comparison

removeTail

OpenLayers.Util.removeTail = function(url)

Takes a url and removes everything after the ? and #

Parameters

url{String} The url to process

Returns

{String} The string with all queryString and Hash removed

getBrowserName

OpenLayers.Util.getBrowserName = function()

Returns

{String} A string which specifies which is the current browser in which we are running.

Currently-supported browser detection and codes

  • ’opera’ -- Opera
  • ’msie’ -- Internet Explorer
  • ’safari’ -- Safari
  • ’firefox’ -- FireFox
  • ’mozilla’ -- Mozilla

If we are unable to property identify the browser, we return an empty string.

getRenderedDimensions

OpenLayers.Util.getRenderedDimensions = function(contentHTML,
size,
options)

Renders the contentHTML offscreen to determine actual dimensions for popup sizing.  As we need layout to determine dimensions the content is rendered -9999px to the left and absolute to ensure the scrollbars do not flicker

Parameters

contentHTML size - {OpenLayers.Size} If either the ‘w’ or ‘h’ properties is specified, we fix that dimension of the div to be measured.  This is useful in the case where we have a limit in one dimension and must therefore meaure the flow in the other dimension. options - {Object} displayClass - {String} Optional parameter.  A CSS class name(s) string to provide the CSS context of the rendered content.

Returns

{OpenLayers.Size}

OpenLayers. Console

The OpenLayers.Console namespace is used for debugging and error logging.  If the Firebug Lite (../Firebug/firebug.js) is included before this script, calls to OpenLayers.Console methods will get redirected to window.console.  This makes use of the Firebug extension where available and allows for cross-browser debugging Firebug style.

Note

Note that behavior will differ with the Firebug extention and Firebug Lite.  Most notably, the Firebug Lite console does not currently allow for hyperlinks to code or for clicking on object to explore their properties.

Summary
OpenLayers custom string, number and function functions are described here.

Files

OpenLayers Base Types

OpenLayers custom string, number and function functions are described here.

OpenLayers. String

Contains convenience functions for string manipulation.

Summary
Used to test strings as numbers.

Properties

OpenLayers. String. numberRegEx

Used to test strings as numbers.

OpenLayers. Number

Contains convenience functions for manipulating numbers.

Summary
Decimal separator to use when formatting numbers.
Thousands separator to use when formatting numbers.

Properties

decimalSeparator

Decimal separator to use when formatting numbers.

thousandsSeparator

Thousands separator to use when formatting numbers.

OpenLayers. Function

Contains convenience functions for function manipulation.

OpenLayers. Array

Contains convenience functions for array manipulation.

Summary
Base class used to construct all other classes.
Deprecated.

Functions

OpenLayers. Class

OpenLayers.Class = function()

Base class used to construct all other classes.  Includes support for multiple inheritance.

This constructor is new in OpenLayers 2.5.  At OpenLayers 3.0, the old syntax for creating classes and dealing with inheritance will be removed.

To create a new OpenLayers-style class, use the following syntax

var MyClass = OpenLayers.Class(prototype);

To create a new OpenLayers-style class with multiple inheritance, use the following syntax:

var MyClass = OpenLayers.Class(Class1, Class2, prototype);

Properties

isPrototype

Deprecated.  This is no longer needed and will be removed at 3.0.

OpenLayers.Size

Instances of this class represent a width/height pair

Summary
Create an instance of OpenLayers.Size
Return the string representation of a size object

Functions

OpenLayers.Size

Create an instance of OpenLayers.Size

Parameters

w{Number} width
h{Number} height

toString

toString:function()

Return the string representation of a size object

Returns

{String} The string representation of OpenLayers.Size object.  (ex.  <i>”w=55,h=66”</i>)

OpenLayers. Bounds

Instances of this class represent bounding boxes.  Data stored as left, bottom, right, top floats.  All values are initialized to null, however, you should make sure you set them before using the bounds for anything.

Possible use case

bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(4,5));
bounds.extend(new OpenLayers.LonLat(5,6));
bounds.toBBOX(); // returns 4,5,5,6
Summary
{Number} Minimum horizontal coordinate.
{Number} Minimum vertical coordinate.
{Number} Maximum horizontal coordinate.
{Number} Maximum vertical coordinate.
{OpenLayers.LonLat} A cached center location.
Construct a new bounds object.
Create a cloned instance of this bounds.
Test a two bounds for equivalence.
Scales the bounds around a pixel or lonlat.
Get the opposite quadrant for a given quadrant string.

Properties

left

{Number} Minimum horizontal coordinate.

bottom

{Number} Minimum vertical coordinate.

right

{Number} Maximum horizontal coordinate.

top

{Number} Maximum vertical coordinate.

centerLonLat

{OpenLayers.LonLat} A cached center location.  This should not be accessed directly.  Use <getCenterLonLat> instead.

Functions

OpenLayers. Bounds

Construct a new bounds object.

Parameters

left{Number} The left bounds of the box.  Note that for width calculations, this is assumed to be less than the right value.
bottom{Number} The bottom bounds of the box.  Note that for height calculations, this is assumed to be more than the top value.
right{Number} The right bounds.
top{Number} The top bounds.

clone

clone:function()

Create a cloned instance of this bounds.

Returns

{OpenLayers.Bounds} A fresh copy of the bounds

equals

equals:function(bounds)

Test a two bounds for equivalence.

Parameters

bounds{OpenLayers.Bounds}

Returns

{Boolean} The passed-in bounds object has the same left, right, top, bottom components as this.  Note that if bounds passed in is null, returns false.

scale

scale: function(ratio,
origin)

Scales the bounds around a pixel or lonlat.  Note that the new bounds may return non-integer properties, even if a pixel is passed.

Parameters

ratio{Float}
origin{OpenLayers.Pixel or OpenLayers.LonLat} Default is center.

Returns

{<OpenLayers.Bound>} A new bounds that is scaled by ratio from origin.

oppositeQuadrant

OpenLayers.Bounds.oppositeQuadrant = function(quadrant)

Get the opposite quadrant for a given quadrant string.

Parameters

quadrant{String} two character quadrant shortstring

Returns

{String} The opposing quadrant (“br” “tr” “tl” “bl”).  For Example, if you pass in “bl” it returns “tr”, if you pass in “br” it returns “tl”, etc.

OpenLayers. Element

Summary
Tests if an element has the given CSS class name.
Add a CSS class name to an element.
Remove a CSS class name from an element.
Remove a CSS class name from an element if it exists.

Functions

hasClass

hasClass: function(element,
name)

Tests if an element has the given CSS class name.

Parameters

element{DOMElement} A DOM element node.
name{String} The CSS class name to search for.

Returns

{Boolean} The element has the given class name.

addClass

addClass: function(element,
name)

Add a CSS class name to an element.  Safe where element already has the class name.

Parameters

element{DOMElement} A DOM element node.
name{String} The CSS class name to add.

Returns

{DOMElement} The element.

removeClass

removeClass: function(element,
name)

Remove a CSS class name from an element.  Safe where element does not have the class name.

Parameters

element{DOMElement} A DOM element node.
name{String} The CSS class name to remove.

Returns

{DOMElement} The element.

toggleClass

toggleClass: function(element,
name)

Remove a CSS class name from an element if it exists.  Add the class name if it doesn’t exist.

Parameters

element{DOMElement} A DOM element node.
name{String} The CSS class name to toggle.

Returns

{DOMElement} The element.

OpenLayers. LonLat

This class represents a longitude and latitude pair

Summary
Create a new map location.
Return a readable string version of the lonlat
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string

Functions

OpenLayers. LonLat

Create a new map location.

Parameters

lon{Number} The x-axis coordinate in map units.  If your map is in a geographic projection, this will be the Longitude.  Otherwise, it will be the x coordinate of the map location in your map units.
lat{Number} The y-axis coordinate in map units.  If your map is in a geographic projection, this will be the Latitude.  Otherwise, it will be the y coordinate of the map location in your map units.

toString

toString:function()

Return a readable string version of the lonlat

Returns

{String} String representation of OpenLayers.LonLat object.  (ex.  <i>”lon=5,lat=42”</i>)

fromString

OpenLayers.LonLat.fromString = function(str)

Alternative constructor that builds a new OpenLayers.LonLat from a parameter string

Parameters

str{String} Comma-separated Lon,Lat coordinate string.  (ex.  <i>”5,40”</i>)

Returns

{OpenLayers.LonLat} New OpenLayers.LonLat object built from the passed-in String.

OpenLayers. Pixel

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

Summary
Create a new OpenLayers.Pixel instance
Cast this object into a string

Functions

OpenLayers. Pixel

Create a new OpenLayers.Pixel instance

Parameters

x{Number} The x coordinate
y{Number} The y coordinate

Returns

An instance of OpenLayers.Pixel

toString

toString:function()

Cast this object into a string

Returns

{String} The string representation of Pixel. ex: “x=200.4,y=242.2”

OpenLayers. Control

Controls affect the display or behavior of the map.  They allow everything from panning and zooming to displaying a scale indicator.  Controls by default are added to the map they are contained within however it is possible to add a control to an external div by passing the div in the options parameter.

Example

The following example shows how to add many of the common controls to a map.

var map = new OpenLayers.Map('map', { controls: [] });

map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
map.addControl(new OpenLayers.Control.Permalink());
map.addControl(new OpenLayers.Control.Permalink('permalink'));
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.OverviewMap());
map.addControl(new OpenLayers.Control.KeyboardDefaults());

The next code fragment is a quick example of how to intercept shift-mouse click to display the extent of the bounding box dragged out by the user.  Usually controls are not created in exactly this manner.  See the source for a more complete example:

var control = new OpenLayers.Control();
OpenLayers.Util.extend(control, {
draw: function () {
// this Handler.Box will intercept the shift-mousedown
// before Control.MouseDefault gets to see it
this.box = new OpenLayers.Handler.Box( control,
{"done": this.notice},
{keyMask: OpenLayers.Handler.MOD_SHIFT});
this.box.activate();
},

notice: function (bounds) {
OpenLayers.Console.userError(bounds);
}
});
map.addControl(control);
Summary
{String}
{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map
{DOMElement}
{OpenLayers.Control.TYPES} Controls can have a ‘type’.
{Boolean} By deafault, controls do not allow selection, because it may interfere with map dragging.
{string} This property is used for CSS related to the drawing of the Control.
{string} This property is used for showing a tooltip over the Control.
{Boolean} The control is active.
{OpenLayers.Events} Events instance for triggering control specific events.
{Array(String)} Supported application event types.
Create an OpenLayers Control.
The destroy method is used to perform any clean up before the control is dereferenced.
Set the map property for the control.
The draw method is called when the control is ready to be displayed on the page.
Sets the left and top style attributes to the passed in pixel coordinates.
Explicitly activates a control and it’s associated handler if one has been set.
Deactivates a control and it’s associated handler if any.

Properties

id

{String}

map

{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map

div

{DOMElement}

type

{OpenLayers.Control.TYPES} Controls can have a ‘type’.  The type determines the type of interactions which are possible with them when they are placed into a toolbar.

allowSelection

{Boolean} By deafault, controls do not allow selection, because it may interfere with map dragging.  If this is true, OpenLayers will not prevent selection of the control.  Default is false.

displayClass

{string} This property is used for CSS related to the drawing of the Control.

title

{string} This property is used for showing a tooltip over the Control.

active

{Boolean} The control is active.

handler

events

{OpenLayers.Events} Events instance for triggering control specific events.

Constants

EVENT_TYPES

{Array(String)} Supported application event types.  Register a listener for a particular event with the following syntax:

control.events.register(type, obj, listener);

Listeners will be called with a reference to an event object.  The properties of this event depends on exactly what happened.

All event objects have at least the following properties

  • object {Object} A reference to control.events.object (a reference to the control).
  • element {DOMElement} A reference to control.events.element (which will be null unless documented otherwise).

Supported map event types

  • activate Triggered when activated.
  • deactivate Triggered when deactivated.

Functions

OpenLayers. Control

Create an OpenLayers Control.  The options passed as a parameter directly extend the control.  For example passing the following:

var control = new OpenLayers.Control({div: myDiv});

Overrides the default div attribute value of null.

Parameters

options{Object}

destroy

destroy: function ()

The destroy method is used to perform any clean up before the control is dereferenced.  Typically this is where event listeners are removed to prevent memory leaks.

setMap

setMap: function(map)

Set the map property for the control.  This is done through an accessor so that subclasses can override this and take special action once they have their map variable set.

Parameters

map{OpenLayers.Map}

draw

draw: function (px)

The draw method is called when the control is ready to be displayed on the page.  If a div has not been created one is created.  Controls with a visual component will almost always want to override this method to customize the look of control.

Parameters

px{OpenLayers.Pixel} The top-left pixel position of the control or null.

Returns

{DOMElement} A reference to the DIV DOMElement containing the control

moveTo

moveTo: function (px)

Sets the left and top style attributes to the passed in pixel coordinates.

Parameters

px{OpenLayers.Pixel}

activate

activate: function ()

Explicitly activates a control and it’s associated handler if one has been set.  Controls can be deactivated by calling the deactivate() method.

Returns

{Boolean} True if the control was successfully activated or false if the control was already active.

deactivate

deactivate: function ()

Deactivates a control and it’s associated handler if any.  The exact effect of this depends on the control itself.

Returns

{Boolean} True if the control was effectively deactivated or false if the control was already inactive.

OpenLayers.Icon

The icon represents a graphical icon on the screen.  Typically used in conjunction with a OpenLayers.Marker to represent markers on a screen.

An icon has a url, size and position.  It also contains an offset which allows the center point to be represented correctly.  This can be provided either as a fixed offset or a function provided to calculate the desired offset.

Summary
{String} image url
{OpenLayers.Pixel} distance in pixels to offset the image when being rendered
{OpenLayers.Pixel} Function to calculate the offset (based on the size)
{DOMElement}
Creates an icon, which is an image tag in a div.
Nullify references and remove event listeners to prevent circular references and memory leaks
{OpenLayers.Icon} A fresh copy of the icon.
Move the div to the given pixel.
Change the icon’s opacity
move icon to passed in px.
Hide or show the icon

Properties

url

{String} image url

offset

{OpenLayers.Pixel} distance in pixels to offset the image when being rendered

calculateOffset

{OpenLayers.Pixel} Function to calculate the offset (based on the size)

imageDiv

{DOMElement}

Functions

OpenLayers.Icon

Creates an icon, which is an image tag in a div.

url{String}
size{OpenLayers.Size}
offset{OpenLayers.Pixel}
calculateOffset{Function}

destroy

destroy: function()

Nullify references and remove event listeners to prevent circular references and memory leaks

clone

clone: function()

Returns

{OpenLayers.Icon} A fresh copy of the icon.

setSize

setSize: function(size)

Parameters

size{OpenLayers.Size}

setUrl

setUrl: function(url)

Parameters

url{String}

draw

draw: function(px)

Move the div to the given pixel.

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A new DOM Image of this icon set at the location passed-in

setOpacity

setOpacity: function(opacity)

Change the icon’s opacity

Parameters

opacity{float}

moveTo

moveTo: function (px)

move icon to passed in px.

Parameters

px{OpenLayers.Pixel}

display

display: function(display)

Hide or show the icon

Parameters

display{Boolean}

OpenLayers.Lang

Internationalization namespace.  Contains dictionaries in various languages and methods to set and get the current language.

Summary
{String} Current language code to use in OpenLayers.

Properties

code

{String} Current language code to use in OpenLayers.  Use the <setCode> method to set this value and the <getCode> method to retrieve it.

OpenLayers. Popup

A popup is a small div that can opened and closed on the map.  Typically opened in response to clicking on a marker.  See OpenLayers.Marker.  Popup’s don’t require their own layer and are added the the map using the <OpenLayers.Map.addPopup> method.

Example

popup = new OpenLayers.Popup("chicken",
new OpenLayers.LonLat(5,40),
new OpenLayers.Size(200,200),
"example popup",
true);

map.addPopup(popup);
Summary
{OpenLayers.Events} custom event manager
{String} the unique identifier assigned to this popup.
{OpenLayers.LonLat} the position of this popup on the map
{DOMElement} the div that contains this popup.
{OpenLayers.Size} the width and height of the content.
{OpenLayers.Size} the width and height of the popup.
{String} An HTML string for this popup to display.
{String} the background color used by the popup.
{float} the opacity of this popup (between 0.0 and 1.0)
{String} the border size of the popup.
{DOMElement} a reference to the element that holds the content of the div.
{DOMElement} First and only child of ‘div’.
{DOMElement} the optional closer image
{String} The CSS class of the popup.
{String} The CSS class of the popup content div.
{int or OpenLayers.Bounds} An extra opportunity to specify internal padding of the content div inside the popup.
To be removed in 3.0, this function merely helps us to deal with the case where the user may have set an integer value for padding, instead of an OpenLayers.Bounds object.
{OpenLayers.Map} this gets set in Map.js when the popup is added to the map
Create a popup.
nullify references to prevent circular references and memory leaks
Constructs the elements that make up the popup.
if the popup has a lonlat and its map members set, then have it move itself to its proper position
{Boolean} Boolean indicating whether or not the popup is visible
Toggles visibility of the popup.
Makes the popup visible.
Makes the popup invisible.
Used to adjust the size of the popup.
Sets the background color of the popup.
Sets the opacity of the popup.
Sets the border style of the popup.
Allows the user to set the HTML content of the popup.
Called when an image contained by the popup loaded.
Glorious, oh glorious hack in order to determine the css ‘padding’ of the contentDiv.
Pans the map such that the popup is totaly viewable (if necessary)
Registers events on the popup.
When mouse goes down within the popup, make a note of it locally, and then do not propagate the mousedown (but do so safely so that user can select text inside)
If the drag was started within the popup, then do not propagate the mousemove (but do so safely so that user can select text inside)
When mouse comes up within the popup, after going down in it, reset the flag, and then (once again) do not propagate the event, but do so safely so that user can select text inside
Ignore clicks, but allowing default browser handling
When mouse goes out of the popup set the flag to false so that if they let go and then drag back in, we won’t be confused.
Ignore double-clicks, but allowing default browser handling

Properties and Functions

events

{OpenLayers.Events} custom event manager

id

{String} the unique identifier assigned to this popup.

lonlat

{OpenLayers.LonLat} the position of this popup on the map

div

{DOMElement} the div that contains this popup.

contentSize

{OpenLayers.Size} the width and height of the content.

size

{OpenLayers.Size} the width and height of the popup.

contentHTML

{String} An HTML string for this popup to display.

backgroundColor

{String} the background color used by the popup.

opacity

{float} the opacity of this popup (between 0.0 and 1.0)

border

{String} the border size of the popup.  (eg 2px)

contentDiv

{DOMElement} a reference to the element that holds the content of the div.

groupDiv

{DOMElement} First and only child of ‘div’.  The group Div contains the ‘contentDiv’ and the ‘closeDiv’.

closeDiv

{DOMElement} the optional closer image

displayClass

{String} The CSS class of the popup.

contentDisplayClass

{String} The CSS class of the popup content div.

padding

{int or OpenLayers.Bounds} An extra opportunity to specify internal padding of the content div inside the popup.  This was originally confused with the css padding as specified in style.css’s ‘olPopupContent’ class.  We would like to get rid of this altogether, except that it does come in handy for the framed and anchoredbubble popups, who need to maintain yet another barrier between their content and the outer border of the popup itself.

Note that in order to not break API, we must continue to support this property being set as an integer.  Really, though, we’d like to have this specified as a Bounds object so that user can specify distinct left, top, right, bottom paddings.  With the 3.0 release we can make this only a bounds.

fixPadding

fixPadding: function()

To be removed in 3.0, this function merely helps us to deal with the case where the user may have set an integer value for padding, instead of an OpenLayers.Bounds object.

map

{OpenLayers.Map} this gets set in Map.js when the popup is added to the map

OpenLayers. Popup

Create a popup.

Parameters

id{String} a unqiue identifier for this popup.  If null is passed an identifier will be automatically generated.
lonlat{OpenLayers.LonLat} The position on the map the popup will be shown.
contentSize{OpenLayers.Size} The size of the content.
contentHTML{String} An HTML string to display inside the popup.
closeBox{Boolean} Whether to display a close box inside the popup.
closeBoxCallback{Function} Function to be called on closeBox click.

destroy

destroy: function()

nullify references to prevent circular references and memory leaks

draw

draw: function(px)

Constructs the elements that make up the popup.

Parameters

px{OpenLayers.Pixel} the position the popup in pixels.

Returns

{DOMElement} Reference to a div that contains the drawn popup

updatePosition

updatePosition: function()

if the popup has a lonlat and its map members set, then have it move itself to its proper position

moveTo

moveTo: function(px)

Parameters

px{OpenLayers.Pixel} the top and left position of the popup div.

visible

visible: function()

Returns

{Boolean} Boolean indicating whether or not the popup is visible

toggle

toggle: function()

Toggles visibility of the popup.

show

show: function()

Makes the popup visible.

hide

hide: function()

Makes the popup invisible.

setSize

setSize:function(contentSize)

Used to adjust the size of the popup.

Parameters

contentSize{OpenLayers.Size} the new size for the popup’s contents div (in pixels).

setBackgroundColor

setBackgroundColor:function(color)

Sets the background color of the popup.

Parameters

color{String} the background color.  eg “#FFBBBB”

setOpacity

setOpacity:function(opacity)

Sets the opacity of the popup.

Parameters

opacity{float} A value between 0.0 (transparent) and 1.0 (solid).

setBorder

setBorder:function(border)

Sets the border style of the popup.

Parameters

border{String} The border style value. eg 2px

setContentHTML

setContentHTML:function(contentHTML)

Allows the user to set the HTML content of the popup.

Parameters

contentHTML{String} HTML for the div.

registerImageListeners

registerImageListeners: function()

Called when an image contained by the popup loaded. this function updates the popup size, then unregisters the image load listener.

getContentDivPadding

getContentDivPadding: function()

Glorious, oh glorious hack in order to determine the css ‘padding’ of the contentDiv.  IE/Opera return null here unless we actually add the popup’s main ‘div’ element (which contains contentDiv) to the DOM.  So we make it invisible and then add it to the document temporarily.

Once we’ve taken the padding readings we need, we then remove it from the DOM (it will actually get added to the DOM in Map.js’s addPopup)

Returns

{OpenLayers.Bounds}

addCloseBox

addCloseBox: function(callback)

Parameters

callback{Function} The callback to be called when the close button is clicked.

panIntoView

panIntoView: function()

Pans the map such that the popup is totaly viewable (if necessary)

registerEvents

registerEvents:function()

Registers events on the popup.

Do this in a separate function so that subclasses can choose to override it if they wish to deal differently with mouse events

Note in the following handler functions that some special care is needed to deal correctly with mousing and popups.

Because the user might select the zoom-rectangle option and then drag it over a popup, we need a safe way to allow the mousemove and mouseup events to pass through the popup when they are initiated from outside.

Otherwise, we want to essentially kill the event propagation for all other events, though we have to do so carefully, without disabling basic html functionality, like clicking on hyperlinks or drag-selecting text.

onmousedown

onmousedown: function (evt)

When mouse goes down within the popup, make a note of it locally, and then do not propagate the mousedown (but do so safely so that user can select text inside)

Parameters

evt{Event}

onmousemove

onmousemove: function (evt)

If the drag was started within the popup, then do not propagate the mousemove (but do so safely so that user can select text inside)

Parameters

evt{Event}

onmouseup

onmouseup: function (evt)

When mouse comes up within the popup, after going down in it, reset the flag, and then (once again) do not propagate the event, but do so safely so that user can select text inside

Parameters

evt{Event}

onclick

onclick: function (evt)

Ignore clicks, but allowing default browser handling

Parameters

evt{Event}

onmouseout

onmouseout: function (evt)

When mouse goes out of the popup set the flag to false so that if they let go and then drag back in, we won’t be confused.

Parameters

evt{Event}

ondblclick

ondblclick: function (evt)

Ignore double-clicks, but allowing default browser handling

Parameters

evt{Event}

OpenLayers. Renderer

This is the base class for all renderers.

This is based on a merger code written by Paul Spencer and Bertil Chapuis.  It is largely composed of virtual functions that are to be implemented in technology-specific subclasses, but there is some generic code too.

The functions that are implemented here merely deal with the maintenance of the size and extent variables, as well as the cached ‘resolution’ value.

A note to the user that all subclasses should use getResolution() instead of directly accessing this.resolution in order to correctly use the cacheing system.

Summary
{DOMElement}
{Boolean} If the renderer is currently in a state where many things are changing, the ‘locked’ property is set to true.
{Float} cache of current map resolution
{OpenLayers.Map} Reference to the map -- this is set in Vector’s setMap()
Set the visible part of the layer.
Sets the size of the drawing surface.
Uses cached copy of resolution if available to minimize computing
Draw the feature.
Draw a geometry.
Clear all vectors from the renderer.
Returns a feature id from an event on the renderer.
This is called by the layer to erase features
Remove a geometry from the renderer (by id).

Properties

container

{DOMElement}

locked

{Boolean} If the renderer is currently in a state where many things are changing, the ‘locked’ property is set to true.  This means that renderers can expect at least one more drawFeature event to be called with the ‘locked’ property set to ‘true’: In some renderers, this might make sense to use as a ‘only update local information’ flag.

resolution

{Float} cache of current map resolution

map

{OpenLayers.Map} Reference to the map -- this is set in Vector’s setMap()

Functions

OpenLayers. Renderer

Parameters

containerID{String}
options{Object} options for this renderer.  See sublcasses for supported options.

setExtent

setExtent: function(extent,
resolutionChanged)

Set the visible part of the layer.

Resolution has probably changed, so we nullify the resolution cache (this.resolution) -- this way it will be re-computed when next it is needed.  We nullify the resolution cache (this.resolution) if resolutionChanged is set to true - this way it will be re-computed on the next getResolution() request.

Parameters

extent{OpenLayers.Bounds}
resolutionChanged{Boolean}

setSize

setSize: function(size)

Sets the size of the drawing surface.

Resolution has probably changed, so we nullify the resolution cache (this.resolution) -- this way it will be re-computed when next it is needed.

Parameters

size{OpenLayers.Size}

getResolution

getResolution: function()

Uses cached copy of resolution if available to minimize computing

Returns

The current map’s resolution

drawFeature

drawFeature: function(feature,
style)

Draw the feature.  The optional style argument can be used to override the feature’s own style.  This method should only be called from layer.drawFeature().

Parameters

feature{OpenLayers.Feature.Vector}
style{<Object>}

Returns

{Boolean} true if the feature has been drawn completely, false if not, undefined if the feature had no geometry

drawGeometry

drawGeometry: function(geometry,
style,
featureId)

Draw a geometry.  This should only be called from the renderer itself.  Use layer.drawFeature() from outside the renderer. virtual function

Parameters

geometry{OpenLayers.Geometry}
style{Object}
featureId{String}

clear

clear: function()

Clear all vectors from the renderer. virtual function.

getFeatureIdFromEvent

getFeatureIdFromEvent: function(evt)

Returns a feature id from an event on the renderer.  How this happens is specific to the renderer.  This should be called from layer.getFeatureFromEvent().  Virtual function.

Parameters

evt{OpenLayers.Event}

Returns

{String} A feature id or null.

eraseFeatures

eraseFeatures: function(features)

This is called by the layer to erase features

Parameters

features{Array(OpenLayers.Feature.Vector)}

eraseGeometry

eraseGeometry: function(geometry)

Remove a geometry from the renderer (by id). virtual function.

Parameters

geometry{OpenLayers.Geometry}

OpenLayers. Request

The OpenLayers.Request namespace contains convenience methods for working with XMLHttpRequests.  These methods work with a cross-browser W3C compliant OpenLayers.Request.XMLHttpRequest class.

Summary
{Object} Default configuration for all requests.

Constants

DEFAULT_CONFIG

{Object} Default configuration for all requests.

OpenLayers. Tween

Summary
{int} Interval in milliseconds between 2 steps
{int} Step counter
{int} Interval id returned by window.setInterval
{Boolean} Tells if the easing is currently playing
Creates a Tween.
Calls the appropriate easing method

Constants

INTERVAL

{int} Interval in milliseconds between 2 steps

Properties

time

{int} Step counter

interval

{int} Interval id returned by window.setInterval

playing

{Boolean} Tells if the easing is currently playing

Functions

OpenLayers. Tween

Creates a Tween.

Parameters

easing{<OpenLayers.Easing>(Function)} easing function method to use

play

play: function()

Calls the appropriate easing method

OpenLayers. Easing

Credits

Easing Equations by Robert Penner, http://www.robertpenner.com/easing/

OpenLayers. Easing. Linear

Functions

easeIn

easeIn: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

easeOut

easeOut: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

easeInOut

easeInOut: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

OpenLayers. Easing.Expo

Functions

easeIn

easeIn: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

easeOut

easeOut: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

easeInOut

easeInOut: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

OpenLayers. Easing.Quad

Functions

easeIn

easeIn: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

easeOut

easeOut: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

easeInOut

easeInOut: function(t,
b,
c,
d)

Parameters

t{Float} time
b{Float} beginning position
c{Float} total change
d{Float} duration of the transition

OpenLayers. Control. ArgParser

Inherits from

Summary
Set the map property for the control.
As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.
As soon as all the layers are loaded, cycle through them and hide or show them.

Functions

OpenLayers. Control. ArgParser

Parameters

options{Object}

setMap

setMap: function(map)

Set the map property for the control.

Parameters

map{OpenLayers.Map}

setCenter

setCenter: function()

As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.

configureLayers

configureLayers: function()

As soon as all the layers are loaded, cycle through them and hide or show them.

OpenLayers. Control. PanZoom

Properties

buttons

{Array(DOMElement)} Array of Button Divs

Functions

OpenLayers. Control. PanZoom

Parameters

options{Object}

draw

draw: function(px)

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A reference to the container div for the PanZoom control.

_addButton

_addButton:function(id,
img,
xy,
sz)

Parameters

id{String}
img{String}
xy{OpenLayers.Pixel}
sz{OpenLayers.Size}

Returns

{DOMElement} A Div (an alphaImageDiv, to be precise) that contains the image of the button, and has all the proper event handlers set.

doubleClick

doubleClick: function (evt)

Parameters

evt{Event}

Returns

{Boolean}

buttonDown

buttonDown: function (evt)

Parameters

evt{Event}

Constants

X

{Integer}

Y

{Integer}

OpenLayers. Event

Utility functions for event handling.

Summary
{Object} A hashtable cache of the event observers.
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
Cross browser event element detection.
Determine whether event was caused by a left click.
Determine whether event was caused by a right mouse click.
Stops an event from propagating.
Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.
Cycle through all the element entries in the events cache and call stopObservingElement on each.

Properties

observers

{Object} A hashtable cache of the event observers.  Keyed by element._eventCacheID

Constants

KEY_BACKSPACE

{int}

KEY_TAB

{int}

KEY_RETURN

{int}

KEY_ESC

{int}

KEY_LEFT

{int}

KEY_UP

{int}

KEY_RIGHT

{int}

KEY_DOWN

{int}

KEY_DELETE

{int}

Functions

element

element: function(event)

Cross browser event element detection.

Parameters

event{Event}

Returns

{DOMElement} The element that caused the event

isLeftClick

isLeftClick: function(event)

Determine whether event was caused by a left click.

Parameters

event{Event}

Returns

{Boolean}

isRightClick

isRightClick: function(event)

Determine whether event was caused by a right mouse click.

Parameters

event{Event}

Returns

{Boolean}

stop

stop: function(event,
allowDefault)

Stops an event from propagating.

Parameters

event{Event}
allowDefault{Boolean} If true, we stop the event chain but still allow the default browser behaviour (text selection, radio-button clicking, etc) Default false

findElement

findElement: function(event,
tagName)

Parameters

event{Event}
tagName{String}

Returns

{DOMElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards

observe

observe: function(elementParam,
name,
observer,
useCapture)

Parameters

elementParam{DOMElement || String}
name{String}
observer{function}
useCapture{Boolean}

stopObservingElement

stopObservingElement: function(elementParam)

Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.

parameters

elementParam{DOMElement || String}

_removeElementObservers

_removeElementObservers: function(elementObservers)

Parameters

elementObservers{Array(Object)} Array of (element, name, observer, usecapture) objects, taken directly from hashtable

stopObserving

stopObserving: function(elementParam,
name,
observer,
useCapture)

Parameters

elementParam{DOMElement || String}
name{String}
observer{function}
useCapture{Boolean}

Returns

{Boolean} Whether or not the event observer was removed

unloadCache

unloadCache: function()

Cycle through all the element entries in the events cache and call stopObservingElement on each.

OpenLayers. Events

Summary
{Array(String)} supported events
{Object} Hashtable of Array(Function): events listener functions
{Object} the code object issuing application events
{DOMElement} the DOM element receiving browser events
{Array(String)} list of support application events
{Function} bound event handler attached to elements
Construct an OpenLayers.Events object.
Convenience method for registering listeners with a common scope.
Convenience method for unregistering listeners with a common scope.
Remove all listeners for a given event type.
Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.

Constants

BROWSER_EVENTS

{Array(String)} supported events

Properties

listeners

{Object} Hashtable of Array(Function): events listener functions

object

{Object} the code object issuing application events

element

{DOMElement} the DOM element receiving browser events

eventTypes

{Array(String)} list of support application events

eventHandler

{Function} bound event handler attached to elements

Functions

OpenLayers. Events

Construct an OpenLayers.Events object.

Parameters

object{Object} The js object to which this Events object is being
added element{DOMElement} A dom element to respond to browser events
eventTypes{Array(String)} Array of custom application events
fallThrough{Boolean} Allow events to fall through after these have been handled?
options{Object} Options for the events object.

attachToElement

attachToElement: function (element)

Parameters

element{HTMLDOMElement} a DOM element to attach browser events to

on

on: function(object)

Convenience method for registering listeners with a common scope.

Example use

events.on({
"loadstart": loadStartListener,
"loadend": loadEndListener,
scope: object
});

un

un: function(object)

Convenience method for unregistering listeners with a common scope.

Example use

events.un({
"loadstart": loadStartListener,
"loadend": loadEndListener,
scope: object
});

remove

remove: function(type)

Remove all listeners for a given event type.  If type is not registered, does nothing.

Parameters

type{String}

handleBrowserEvent

handleBrowserEvent: function (evt)

Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.

Parameters

evt{Event}

getMousePosition

getMousePosition: function (evt)

Parameters

evt{Event}

Returns

{OpenLayers.Pixel} The current xy coordinate of the mouse, adjusted for offsets

OpenLayers. Format

Base class for format reading/writing a variety of formats.  Subclasses of OpenLayers.Format are expected to have read and write methods.

Summary
{Object} A reference to options passed to the constructor.
Instances of this class are not useful.
Read data from a string, and return an object whose type depends on the subclass.
Accept an object, and return a string.

Properties

options

{Object} A reference to options passed to the constructor.

Functions

OpenLayers. Format

Instances of this class are not useful.  See one of the subclasses.

Parameters

options{Object} An optional object with properties to set on the format

Returns

An instance of OpenLayers.Format

read

read: function(data)

Read data from a string, and return an object whose type depends on the subclass.

Parameters

data{string} Data to read/parse.

Returns

Depends on the subclass

write

write: function(object)

Accept an object, and return a string.

Parameters

object{Object} Object to be serialized

Returns

{String} A string representation of the object.

OpenLayers. Lang[“en”]

Dictionary for English.  Keys for entries are used in calls to <OpenLayers.Lang.translate>.  Entry bodies are normal strings or strings formatted for use with <OpenLayers.String.format> calls.

OpenLayers. Popup. Anchored

Inherits from

Summary
Since the popup is moving to a new px, it might need also to be moved relative to where the marker is.
The popup has been moved to a new relative location, so we may want to make some cosmetic adjustments to it.

Functions

OpenLayers. Popup. Anchored

Parameters

id{String}
lonlat{OpenLayers.LonLat}
contentSize{OpenLayers.Size}
contentHTML{String}
anchor{Object} Object which must expose a ‘size’ OpenLayers.Size and ‘offset’ OpenLayers.Pixel (generally an OpenLayers.Icon).
closeBox{Boolean}
closeBoxCallback{Function} Function to be called on closeBox click.

moveTo

moveTo: function(px)

Since the popup is moving to a new px, it might need also to be moved relative to where the marker is.  We first calculate the new relativePosition, and then we calculate the new px where we will put the popup, based on the new relative position.

If the relativePosition has changed, we must also call updateRelativePosition() to make any visual changes to the popup which are associated with putting it in a new relativePosition.

Parameters

px{OpenLayers.Pixel}

calculateRelativePosition

calculateRelativePosition:function(px)

Parameters

px{OpenLayers.Pixel}

Returns

{String} The relative position (“br” “tr” “tl” “bl”) at which the popup should be placed.

updateRelativePosition

updateRelativePosition: function()

The popup has been moved to a new relative location, so we may want to make some cosmetic adjustments to it.

Note that in the classic Anchored popup, there is nothing to do here, since the popup looks exactly the same in all four positions.  Subclasses such as the AnchoredBubble and Framed, however, will want to do something special here.

calculateNewPx

calculateNewPx:function(px)

Parameters

px{OpenLayers.Pixel}

Returns

{OpenLayers.Pixel} The the new px position of the popup on the screen relative to the passed-in px.

OpenLayers. Projection

Class for coordinate transforms between coordinate systems.  Depends on the proj4js library.  If proj4js is not available, then this is just an empty stub.

Summary
{Object} Proj4js.Proj instance.
{String}
This class offers several methods for interacting with a wrapped pro4js projection object.
Convert projection to string (getCode wrapper).
Test equality of two projection instances.
Destroy projection object.
Transforms is an object, with from properties, each of which may have a to property.

Properties

proj

{Object} Proj4js.Proj instance.

projCode

{String}

Functions

OpenLayers. Projection

This class offers several methods for interacting with a wrapped pro4js projection object.

Parameters

options{Object} An optional object with properties to set on the format

Returns

{OpenLayers.Projection} A projection object.

toString

toString: function()

Convert projection to string (getCode wrapper).

Returns

{String} The projection code.

equals

equals: function(projection)

Test equality of two projection instances.  Determines equality based soley on the projection code.

Returns

{Boolean} The two projections are equivalent.

destroy

destroy: function()

Destroy projection object.

Properties

transforms

Transforms is an object, with from properties, each of which may have a to property.  This allows you to define projections without requiring support for proj4js to be included.

This object has keys which correspond to a ‘source’ projection object.  The keys should be strings, corresponding to the projection.getCode() value.  Each source projection object should have a set of destination projection keys included in the object.

Each value in the destination object should be a transformation function, where the function is expected to be passed an object with a .x and a .y property.  The function should return the object, with the .x and .y transformed according to the transformation function.

NoteProperties on this object should not be set directly.  To add a transform method to this object, use the <addTransform> method.  For an example of usage, see the OpenLayers.Layer.SphericalMercator file.

OpenLayers. Renderer. Canvas

A renderer based on the 2D ‘canvas’ drawing element.element

Inherits

Summary
{DOMElement} root element of canvas.
{Canvas} The canvas context object.
{Object} Internal object of feature/style pairs for use in redrawing the layer.
{Object} Geometry -> Feature lookup table.
Erase a geometry from the renderer.
Set the visible part of the layer.
Sets the size of the drawing surface.
Draw the feature.
Used when looping (in redraw) over the features; draws the canvas.
Called to draw External graphics.
Prepare the canvas for drawing by setting various global settings.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
transform geographic xy into pixel xy
Clear all vectors from the renderer.
Returns a feature id from an event on the renderer.
This is called by the layer to erase features; removes the feature from the list, then redraws the layer.
The real ‘meat’ of the function: any time things have changed, redraw() can be called to loop over all the data and (you guessed it) redraw it.

Properties

root

{DOMElement} root element of canvas.

canvas

{Canvas} The canvas context object.

features

{Object} Internal object of feature/style pairs for use in redrawing the layer.

geometryMap

{Object} Geometry -> Feature lookup table.  Used by eraseGeometry to lookup features to remove from our internal table (this.features) when erasing geoms.

Functions

OpenLayers. Renderer. Canvas

Parameters

containerID{String}

eraseGeometry

eraseGeometry: function(geometry)

Erase a geometry from the renderer.  Because the Canvas renderer has ‘memory’ of the features that it has drawn, we have to remove the feature so it doesn’t redraw.

Parameters

geometry{OpenLayers.Geometry}

setExtent

setExtent: function(extent)

Set the visible part of the layer.

Resolution has probably changed, so we nullify the resolution cache (this.resolution), then redraw.

Parameters

extent{OpenLayers.Bounds}

setSize

setSize: function(size)

Sets the size of the drawing surface.

Once the size is updated, redraw the canvas.

Parameters

size{OpenLayers.Size}

drawFeature

drawFeature: function(feature,
style)

Draw the feature.  Stores the feature in the features list, then redraws the layer.

Parameters

feature{OpenLayers.Feature.Vector}
style{<Object>}

drawGeometry

drawGeometry: function(geometry,
style)

Used when looping (in redraw) over the features; draws the canvas.

Parameters

geometry{OpenLayers.Geometry}
style{Object}
featureId{String}

drawExternalGraphic

drawExternalGraphic: function(pt,
style)

Called to draw External graphics.

Parameters

geometry{OpenLayers.Geometry}
style{Object}

setCanvasStyle

setCanvasStyle: function(type,
style)

Prepare the canvas for drawing by setting various global settings.

Parameters

type{String} one of ‘stroke’, ‘fill’, or ‘reset’
style{Object} Symbolizer hash

drawPoint

drawPoint: function(geometry,
style)

This method is only called by the renderer itself.

Parameters

geometry{OpenLayers.Geometry}
style{Object}

drawLineString

drawLineString: function(geometry,
style)

This method is only called by the renderer itself.

Parameters

geometry{OpenLayers.Geometry}
style{Object}

drawLinearRing

drawLinearRing: function(geometry,
style)

This method is only called by the renderer itself.

Parameters

geometry{OpenLayers.Geometry}
style{Object}

drawPolygon

drawPolygon: function(geometry,
style)

This method is only called by the renderer itself.

Parameters

geometry{OpenLayers.Geometry}
style{Object}

getLocalXY

getLocalXY: function(point)

transform geographic xy into pixel xy

Parameters

point{OpenLayers.Geometry.Point}

clear

clear: function()

Clear all vectors from the renderer. virtual function.

getFeatureIdFromEvent

getFeatureIdFromEvent: function(evt)

Returns a feature id from an event on the renderer.

Parameters

evt{OpenLayers.Event}

Returns

{String} A feature id or null.

eraseFeatures

eraseFeatures: function(features)

This is called by the layer to erase features; removes the feature from the list, then redraws the layer.

Parameters

features{Array(OpenLayers.Feature.Vector)}

redraw

redraw: function()

The real ‘meat’ of the function: any time things have changed, redraw() can be called to loop over all the data and (you guessed it) redraw it.  Unlike Elements-based Renderers, we can’t interact with things once they’re drawn, to remove them, for example, so instead we have to just clear everything and draw from scratch.

OpenLayers. ElementsIndexer

This class takes care of figuring out which order elements should be placed in the DOM based on given indexing methods.

Summary
{Integer} This is the largest-most z-index value for a node contained within the indexer.
{Array<String>} This is an array of node id’s stored in the order that they should show up on screen.
{Object} This is a hash that maps node ids to their z-index value stored in the indexer.
{Function} This is the function used to determine placement of of a new node within the indexer.
Determine the z-index for the current node if there isn’t one, and set the maximum value if we’ve found a new maximum.

Properties

maxZIndex

{Integer} This is the largest-most z-index value for a node contained within the indexer.

order

{Array<String>} This is an array of node id’s stored in the order that they should show up on screen.  Id’s higher up in the array (higher array index) represent nodes with higher z-indeces.

indices

{Object} This is a hash that maps node ids to their z-index value stored in the indexer.  This is done to make finding a nodes z-index value O(1).

compare

{Function} This is the function used to determine placement of of a new node within the indexer.  If null, this defaults to to the Z_ORDER_DRAWING_ORDER comparison method.

Functions

determineZIndex

determineZIndex: function(node)

Determine the z-index for the current node if there isn’t one, and set the maximum value if we’ve found a new maximum.

Parameters

node{DOMElement}

OpenLayers. ElementsIndexer. IndexingMethods

These are the compare methods for figuring out where a new node should be placed within the indexer.  These methods are very similar to general sorting methods in that they return -1, 0, and 1 to specify the direction in which new nodes fall in the ordering.

Summary
This compare method is used by other comparison methods.

Functions

Z_ORDER

Z_ORDER: function(indexer,
newNode,
nextNode)

This compare method is used by other comparison methods.  It can be used individually for ordering, but is not recommended, because it doesn’t subscribe to drawing order.

Parameters

indexer{OpenLayers.ElementsIndexer}
newNode{DOMElement}
nextNode{DOMElement}

Returns

{Integer}

OpenLayers. Renderer. Elements

This is another virtual class in that it should never be instantiated by itself as a Renderer.  It exists because there is tons of shared functionality between different vector libraries which use nodes/elements as a base for rendering vectors.

The highlevel bits of code that are implemented here are the adding and removing of geometries, which is essentially the same for any element-based renderer.  The details of creating each node and drawing the paths are of course different, but the machinery is the same.

Inherits

Summary
{DOMElement}
{DOMElement}
{String}
{<OpenLayers.ElementIndexer>} An instance of OpenLayers.ElementsIndexer created upon initialization if the zIndexing or yOrdering options passed to this renderer’s constructor are set to true.
{String}
{Object}
Remove all the elements from the root
This function is in charge of asking the specific renderer which type of node to create for the given geometry and style.
Draw the geometry, creating new nodes, setting paths, setting style, setting featureId on the node.
Redraws the node using special ‘background’ style properties.
Given a node, draw a geometry on the specified layer.
Things that have do be done after the geometry node is appended to its parent node.
Virtual function for drawing Point Geometry.
Virtual function for drawing LineString Geometry.
Virtual function for drawing LinearRing Geometry.
Virtual function for drawing Polygon Geometry.
Virtual function for drawing Rectangle Geometry.
Virtual function for drawing Circle Geometry.
Virtual function for drawing Surface Geometry.
Erase a geometry from the renderer.
Create new node of the specified type, with the (optional) specified id.
Determines if a symbol cannot be rendered using drawCircle
Coordinate arrays for well known (named) symbols.

Properties

rendererRoot

{DOMElement}

root

{DOMElement}

xmlns

{String}

Indexer

{<OpenLayers.ElementIndexer>} An instance of OpenLayers.ElementsIndexer created upon initialization if the zIndexing or yOrdering options passed to this renderer’s constructor are set to true.

Constants

BACKGROUND_ID_SUFFIX

{String}

Properties

minimumSymbolizer

{Object}

Functions

OpenLayers. Renderer. Elements

Parameters

containerID{String}
options{Object} options for this renderer.  Supported options are:
  • yOrdering - {Boolean} Whether to use y-ordering
  • zIndexing - {Boolean} Whether to use z-indexing.  Will be ignored if yOrdering is set to true.

destroy

destroy: function()

clear

clear: function()

Remove all the elements from the root

getNodeType

getNodeType: function(geometry,
style)

This function is in charge of asking the specific renderer which type of node to create for the given geometry and style.  All geometries in an Elements-based renderer consist of one node and some attributes.  We have the nodeFactory() function which creates a node for us, but it takes a ‘type’ as input, and that is precisely what this function tells us.

Parameters

geometry{OpenLayers.Geometry}
style{Object}

Returns

{String} The corresponding node type for the specified geometry

drawGeometry

drawGeometry: function(geometry,
style,
featureId)

Draw the geometry, creating new nodes, setting paths, setting style, setting featureId on the node.  This method should only be called by the renderer itself.

Parameters

geometry{OpenLayers.Geometry}
style{Object}
featureId{String}

Returns

{Boolean} true if the geometry has been drawn completely; null if incomplete; false otherwise

redrawNode

redrawNode: function(id,
geometry,
style,
featureId)

Parameters

id{String}
geometry{OpenLayers.Geometry}
style{Object}
featureId{String}

Returns

{Boolean} true if the complete geometry could be drawn, null if parts of the geometry could not be drawn, false otherwise

redrawBackgroundNode

redrawBackgroundNode: function(id,
geometry,
style,
featureId)

Redraws the node using special ‘background’ style properties.  Basically just calls redrawNode(), but instead of directly using the ‘externalGraphic’, ‘graphicXOffset’, ‘graphicYOffset’, and ‘graphicZIndex’ properties directly from the specified ‘style’ parameter, we create a new style object and set those properties from the corresponding ‘background’-prefixed properties from specified ‘style’ parameter.

Parameters

id{String}
geometry{OpenLayers.Geometry}
style{Object}
featureId{String}

Returns

{Boolean} true if the complete geometry could be drawn, null if parts of the geometry could not be drawn, false otherwise

drawGeometryNode

drawGeometryNode: function(node,
geometry,
style)

Given a node, draw a geometry on the specified layer. node and geometry are required arguments, style is optional.  This method is only called by the render itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}
style{Object}

Returns

{Object} a hash with properties “node” (the drawn node) and “complete” (null if parts of the geometry could not be drawn, false if nothing could be drawn)

postDraw

postDraw: function(node)

Things that have do be done after the geometry node is appended to its parent node.  To be overridden by subclasses.

Parameters

node{DOMElement}

drawPoint

drawPoint: function(node,
geometry)

Virtual function for drawing Point Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the point

drawLineString

drawLineString: function(node,
geometry)

Virtual function for drawing LineString Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the linestring, or false if nothing could be drawn

drawLinearRing

drawLinearRing: function(node,
geometry)

Virtual function for drawing LinearRing Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the linear ring, or false if nothing could be drawn

drawPolygon

drawPolygon: function(node,
geometry)

Virtual function for drawing Polygon Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the polygon, or false if nothing could be drawn

drawRectangle

drawRectangle: function(node,
geometry)

Virtual function for drawing Rectangle Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the rectangle

drawCircle

drawCircle: function(node,
geometry)

Virtual function for drawing Circle Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the circle

drawSurface

drawSurface: function(node,
geometry)

Virtual function for drawing Surface Geometry.  Should be implemented by subclasses.  This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the surface

getFeatureIdFromEvent

getFeatureIdFromEvent: function(evt)

Parameters

evt{Object} An OpenLayers.Event object

Returns

{OpenLayers.Geometry} A geometry from an event that happened on a layer.

eraseGeometry

eraseGeometry: function(geometry)

Erase a geometry from the renderer.  In the case of a multi-geometry, we cycle through and recurse on ourselves.  Otherwise, we look for a node with the geometry.id, destroy its geometry, and remove it from the DOM.

Parameters

geometry{OpenLayers.Geometry}

nodeFactory

nodeFactory: function(id,
type)

Create new node of the specified type, with the (optional) specified id.

If node already exists with same ID and a different type, we remove it and then call ourselves again to recreate it.

Parameters

id{String}
type{String} type Kind of node to draw.

Returns

{DOMElement} A new node of the given type and id.

nodeTypeCompare

nodeTypeCompare: function(node,
type)

Parameters

node{DOMElement}
type{String} Kind of node

Returns

{Boolean} Whether or not the specified node is of the specified type This function must be overridden by subclasses.

createNode

createNode: function(type,
id)

Parameters

type{String} Kind of node to draw.
id{String} Id for node.

Returns

{DOMElement} A new node of the given type and id.  This function must be overridden by subclasses.

isComplexSymbol

isComplexSymbol: function(graphicName)

Determines if a symbol cannot be rendered using drawCircle

Parameters

graphicName{String}

Returns {Boolean} true if the symbol is complex, false if not

Constants

OpenLayers. Renderer. symbol

Coordinate arrays for well known (named) symbols.

OpenLayers. Request. XMLHttpRequest

Standard-compliant (W3C) cross-browser implementation of the XMLHttpRequest object.  From http://code.google.com/p/xmlhttprequest/.

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 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.  Create a new tile with the OpenLayers.Tile constructor, or a subclass.

TBD 3.0remove reference to url in above paragraph
Summary
{Array(String)} Supported application event types
{String} null
{OpenLayers.Layer} layer the tile is attached to
{String} url of the request.
{OpenLayers.Pixel} Top Left pixel of the tile
{Boolean} Is the tile loading?
Constructor for a new OpenLayers.Tile instance.
Call immediately before destroying if you are listening to tile events, so that counters are properly handled if tile is still loading at destroy-time.
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.
Reposition the tile.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.
Show the tile only if it should be drawn.
Show the tile.
Hide the tile.
@param {} request
Parse XML into a doc structure

Constants

EVENT_TYPES

{Array(String)} Supported application event types

Properties

id

{String} null

layer

{OpenLayers.Layer} layer the tile is attached to

url

{String} url of the request.

TBD 3.0 Deprecated.  The base tile class does not need an url.  This should be handled in subclasses.  Does not belong here.

size

position

{OpenLayers.Pixel} Top Left pixel of the tile

isLoading

{Boolean} Is the tile loading?

Functions

OpenLayers.Tile

Constructor for a new OpenLayers.Tile instance.

Parameters

layer{OpenLayers.Layer} layer that the tile will go in.
position{OpenLayers.Pixel}
bounds{OpenLayers.Bounds}
url{String}
size{OpenLayers.Size}

unload

unload: function()

Call immediately before destroying if you are listening to tile events, so that counters are properly handled if tile is still loading at destroy-time.  Will only fire an event if the tile is still loading.

clone

clone: function (obj)

Parameters

obj{OpenLayers.Tile} The tile to be cloned

Returns

{OpenLayers.Tile} An exact clone of this OpenLayers.Tile

draw

draw: function()

Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.

Returns

{Boolean} Whether or not the tile should actually be drawn.  Note that this is not really the best way of doing things, but such is the way the code has been developed.  Subclasses call this and depend on the return to know if they should draw or not.

moveTo

moveTo: function (bounds,
position,
redraw)

Reposition the tile.

Parameters

bounds{OpenLayers.Bounds}
position{OpenLayers.Pixel}
redraw{Boolean} Call draw method on tile after moving.  Default is true

clear

clear: function()

Clear the tile of any bounds/position-related data so that it can be reused in a new location.  To be implemented by subclasses.

getBoundsFromBaseLayer

getBoundsFromBaseLayer: function(position)

Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.

Parameters

position{OpenLayers.Pixel}

Returns

bounds{OpenLayers.Bounds}

showTile

showTile: function()

Show the tile only if it should be drawn.

show

show: function()

Show the tile.  To be implemented by subclasses.

hide

hide: function()

Hide the tile.  To be implemented by subclasses.

OpenLayers. nullHandler

OpenLayers.nullHandler = function(request)

@param {} request

parseXMLString

OpenLayers.parseXMLString = function(text)

Parse XML into a doc structure

Parameters

text{String}

Returns

{?}  Parsed AJAX Responsev

OpenLayers.Ajax

Summary
{Object} Transport mechanism for whichever browser we’re in, or false if none available.
{Integer}

Functions

emptyFunction

emptyFunction: function ()

getTransport

getTransport: function()

Returns

{Object} Transport mechanism for whichever browser we’re in, or false if none available.

Properties

activeRequestCount

{Integer}

OpenLayers. Ajax. Responders

Properties

responders

{Array}

Functions

register

register: function(responderToAdd)

Parameters

responderToAdd{?}

unregister

unregister: function(responderToRemove)

Parameters

responderToRemove{?}

dispatch

dispatch: function(callback,
request,
transport)

Parameters

callback{?}
request{?}
transport{?}

onCreate

onCreate: function()

onComplete

onComplete: function()

OpenLayers. Ajax.Base

Functions

OpenLayers. Ajax.Base

Parameters

options{Object}

OpenLayers. Ajax. Request

Deprecated.  Use OpenLayers.Request method instead.

Inherit

Summary
{Boolean}
{Boolean} -
If the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.
{Array(String)}

Properties

_complete

{Boolean}

Functions

OpenLayers. Ajax. Request

Parameters

url{String}
options{Object}

request

request: function(url)

Parameters

url{String}

onStateChange

onStateChange: function()

setRequestHeaders

setRequestHeaders: function()

success

success: function()

Returns

{Boolean} -

getStatus

getStatus: function()

Returns

{Integer}Status

respondToReadyState

respondToReadyState: function(readyState)

Parameters

readyState{?}

getHeader

getHeader: function(name)

Parameters

name{String} Header name

Returns

{?}response header for the given name

dispatchException

dispatchException: function(exception)

If the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.

If no optional onException function is set, we suspect that the user may have also not used OpenLayers.Ajax.Responders.register to register a listener for the onException call.  To make sure that something gets done with this exception, only dispatch the call if there are listeners.

If you explicitly want to swallow exceptions, set request.options.onException to an empty function (function(){}) or register an empty function with OpenLayers.Ajax.Responders for onException.

Parameters

exception{?}

Properties

Events

{Array(String)}

OpenLayers. Ajax. Response

Summary

Properties

status

{Integer}

statusText

{String}

Functions

OpenLayers. Ajax. Response

Parameters

request{Object}

getStatus

getStatustext

Returns

{String}statusText

getHeader

getResponseHeader

getResponseHeader: function(name)

Returns

{?}response header for given name

getElementsByTagNameNS

OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode,
nsuri,
nsprefix,
tagname)

Parameters

parentnode{?}
nsuri{?}
nsprefix{?}
tagname{?}

Returns

{?}

serializeXMLToString

OpenLayers.Ajax.serializeXMLToString = function(xmldom)

Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.  We need to come up with a way to serialize in those browser: for now, these browsers will just fail.  #535, #536

Parameters

xmldom {XMLNode} xml dom to serialize

Returns

{?}

OpenLayers. Handler

Base class to construct a higher-level handler for event sequences.  All handlers have activate and deactivate methods.  In addition, they have methods named like browser events.  When a handler is activated, any additional methods named like a browser event is registered as a listener for the corresponding event.  When a handler is deactivated, those same methods are unregistered as event listeners.

Handlers also typically have a callbacks object with keys named like the abstracted events or event sequences that they are in charge of handling.  The controls that wrap handlers define the methods that correspond to these abstract events - so instead of listening for individual browser events, they only listen for the abstract events defined by the handler.

Handlers are created by controls, which ultimately have the responsibility of making changes to the the state of the application.  Handlers themselves may make temporary changes, but in general are expected to return the application in the same state that they found it.

Summary
{String}
{Boolean}
{Event} This property references the last event handled by the handler.
Construct a handler.
Check the keyMask on the handler.
Trigger the control’s named callback with the given arguments
register an event on the map
unregister an event from the map
With each registered browser event, the handler sets its own evt property.
Deconstruct the handler.
If set as the <keyMask>, checkModifiers returns false if any key is down.
If set as the <keyMask>, checkModifiers returns false if Shift is down.
If set as the <keyMask>, checkModifiers returns false if Ctrl is down.
If set as the <keyMask>, checkModifiers returns false if Alt is down.

Properties

id

{String}

active

{Boolean}

evt

{Event} This property references the last event handled by the handler.  Note that this property is not part of the stable API.  Use of the evt property should be restricted to controls in the library or other applications that are willing to update with changes to the OpenLayers code.

Functions

OpenLayers. Handler

Construct a handler.

Parameters

control{OpenLayers.Control} The control that initialized this handler.  The control is assumed to have a valid map property; that map is used in the handler’s own setMap method.
callbacks{Object} An object whose properties correspond to abstracted events or sequences of browser events.  The values for these properties are functions defined by the control that get called by the handler.
options{Object} An optional object whose properties will be set on the handler.

setMap

setMap: function (map)

checkModifiers

checkModifiers: function (evt)

Check the keyMask on the handler.  If no <keyMask> is set, this always returns true.  If a <keyMask> is set and it matches the combination of keys down on an event, this returns true.

Returns

{Boolean} The keyMask matches the keys down on an event.

callback

callback: function (name,
args)

Trigger the control’s named callback with the given arguments

Parameters

name{String} The key for the callback that is one of the properties of the handler’s callbacks object.
args{Array(*)} An array of arguments (any type) with which to call the callback (defined by the control).

register

register: function (name,
method)

register an event on the map

unregister

unregister: function (name,
method)

unregister an event from the map

setEvent

setEvent: function(evt)

With each registered browser event, the handler sets its own evt property.  This property can be accessed by controls if needed to get more information about the event that the handler is processing.

This allows modifier keys on the event to be checked (alt, shift, and ctrl cannot be checked with the keyboard handler).  For a control to determine which modifier keys are associated with the event that a handler is currently processing, it should access (code)handler.evt.altKey || handler.evt.shiftKey || handler.evt.ctrlKey(end).

Parameters

evt{Event} The browser event.

destroy

destroy: function ()

Deconstruct the handler.

Constants

OpenLayers. Handler. MOD_NONE

If set as the <keyMask>, checkModifiers returns false if any key is down.

OpenLayers. Handler. MOD_SHIFT

If set as the <keyMask>, checkModifiers returns false if Shift is down.

OpenLayers. Handler. MOD_CTRL

If set as the <keyMask>, checkModifiers returns false if Ctrl is down.

OpenLayers. Handler. MOD_ALT

If set as the <keyMask>, checkModifiers returns false if Alt is down.

OpenLayers.Map

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

On their own maps do not provide much functionality.  To extend a map it’s necessary to add controls (OpenLayers.Control) and layers (OpenLayers.Layer) to the map.

Summary
{Object} Base z-indexes for different classes of thing
{Array(String)} Supported application event types.
{String} Unique identifier for the map
{Boolean} For a base layer that supports it, allow the map resolution to be set to a value between one of the values in the resolutions array.
{Boolean} The map is currently being dragged.
{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.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
{Float} The resolution of the map.
{Integer} The current zoom level of the map
{Float} The ratio of the current extent within which panning will tween.
{String} Used to store a unique identifier that changes when the map view changes.
{OpenLayers.Tween} Animated panning tween object, see panTo()
{Function} The Easing function to be used for tweening.
{OpenLayers.Bounds} Outside margin of the popup.
Constructor for a new OpenLayers.Map instance.
Function that is called to destroy the map on page unload.
When the map is destroyed, we need to stop listening to updateSize events: this method stores the function we need to unregister in non-IE browsers.
Reset each layer’s z-index based on layer’s array index
{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div
This function takes care to recenter the layerContainerDiv.
{Integer} 256 Default tile width (unless otherwise specified)
{Integer} 256 Default tile height (unless otherwise specified)

Constants

Z_INDEX_BASE

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

EVENT_TYPES

{Array(String)} Supported application event types.  Register a listener for a particular event with the following syntax:

map.events.register(type, obj, listener);

Listeners will be called with a reference to an event object.  The properties of this event depends on exactly what happened.

All event objects have at least the following properties

  • object {Object} A reference to map.events.object.
  • element {DOMElement} A reference to map.events.element.

Browser events have the following additional properties

  • xy {OpenLayers.Pixel} The pixel location of the event (relative to the the map viewport).
  • other properties that come with browser events

Supported map event types

  • preaddlayer triggered before a layer has been added.  The event object will include a layer property that references the layer to be added.
  • addlayer triggered after a layer has been added.  The event object will include a layer property that references the added layer.
  • removelayer triggered after a layer has been removed.  The event object will include a layer property that references the removed layer.
  • changelayer triggered after a layer name change, order change, or visibility change (due to resolution thresholds).  Listeners will receive an event object with layer and property properties.  The layer property will be a reference to the changed layer.  The property property will be a key to the changed property (name, visibility, or order).
  • movestart triggered after the start of a drag, pan, or zoom
  • move triggered after each drag, pan, or zoom
  • moveend triggered after a drag, pan, or zoom completes
  • zoomend triggered after a zoom completes
  • popupopen triggered after a popup opens
  • popupclose triggered after a popup opens
  • addmarker triggered after a marker has been added
  • removemarker triggered after a marker has been removed
  • clearmarkers triggered after markers have been cleared
  • mouseover triggered after mouseover the map
  • mouseout triggered after mouseout the map
  • mousemove triggered after mousemove the map
  • dragstart triggered after the start of a drag
  • drag triggered after a drag
  • dragend triggered after the end of a drag
  • changebaselayer triggered after the base layer changes

Properties

id

{String} Unique identifier for the map

fractionalZoom

{Boolean} For a base layer that supports it, allow the map resolution to be set to a value between one of the values in the resolutions array.  Default is false.

When fractionalZoom is set to true, it is possible to zoom to an arbitrary extent.  This requires a base layer from a source that supports requests for arbitrary extents (i.e. not cached tiles on a regular lattice).  This means that fractionalZoom will not work with commercial layers (Google, Yahoo, VE), layers using TileCache, or any other pre-cached data sources.

If you are using fractionalZoom, then you should also use <getResolutionForZoom> instead of layer.resolutions[zoom] as the former works for non-integer zoom levels.

dragging

{Boolean} The map is currently being dragged.

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.

controls

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

If not provided in the map options at construction, the map will be given the following controls by default:

popups

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

center

{OpenLayers.LonLat} The current center of the map

resolution

{Float} The resolution of the map.

zoom

{Integer} The current zoom level of the map

panRatio

{Float} The ratio of the current extent within which panning will tween.

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

panTween

{OpenLayers.Tween} Animated panning tween object, see panTo()

panMethod

{Function} The Easing function to be used for tweening.  Default is OpenLayers.Easing.Expo.easeOut.  Setting this to ‘null’ turns off animated panning.

paddingForPopups

{OpenLayers.Bounds} Outside margin of the popup.  Used to prevent the popup from getting too close to the map border.

Functions

OpenLayers.Map

Constructor for a new OpenLayers.Map instance.

Parameters

div{String} Id of an element in your page that will contain the map.
options{Object} 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: 'm',
projection: "EPSG:41001"
};
var map = new OpenLayers.Map("map2", options);

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.

updateSizeDestroy

When the map is destroyed, we need to stop listening to updateSize events: this method stores the function we need to unregister in non-IE browsers.

setLayerZIndex

setLayerZIndex: function (layer,
zIdx)

Parameters

layer{OpenLayers.Layer}
zIdx{int}

resetLayersZIndex

resetLayersZIndex: function()

Reset each layer’s z-index based on layer’s array index

addControlToMap

addControlToMap: function (control,
px)

Parameters

control{OpenLayers.Control}
px{OpenLayers.Pixel}

getCurrentSize

getCurrentSize: function()

Returns

{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div

calculateBounds

calculateBounds: function(center,
resolution)

Parameters

center{OpenLayers.LonLat} Default is this.getCenter()
resolution{float} Default is this.getResolution()

Returns

{OpenLayers.Bounds} A bounds based on resolution, center, and current mapsize.

moveTo

moveTo: function(lonlat,
zoom,
options)

Parameters

lonlat{OpenLayers.LonLat}
zoom{Integer}
options{Object}

centerLayerContainer

centerLayerContainer: function (lonlat)

This function takes care to recenter the layerContainerDiv.

Parameters

lonlat{OpenLayers.LonLat}

isValidZoomLevel

isValidZoomLevel: function(zoomLevel)

Parameters

zoomLevel{Integer}

Returns

{Boolean} Whether or not the zoom level passed in is non-null and within the min/max range of zoom levels.

isValidLonLat

isValidLonLat: function(lonlat)

Parameters

lonlat{OpenLayers.LonLat}

Returns

{Boolean} Whether or not the lonlat passed in is non-null and within the maxExtent bounds

getLonLatFromViewPortPx

getLonLatFromViewPortPx: function (viewPortPx)

Parameters

viewPortPx{OpenLayers.Pixel}

Returns

{OpenLayers.LonLat} An OpenLayers.LonLat which is the passed-in view port OpenLayers.Pixel, translated into lon/lat by the current base layer.

getLonLatFromLayerPx

getLonLatFromLayerPx: function (px)

Parameters

px{OpenLayers.Pixel}

Returns

{OpenLayers.LonLat}

Constants

TILE_WIDTH

{Integer} 256 Default tile width (unless otherwise specified)

TILE_HEIGHT

{Integer} 256 Default tile height (unless otherwise specified)

OpenLayers. Marker

Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.

Markers are generally added to a special layer called OpenLayers.Layer.Markers.

Example

var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);

var size = new OpenLayers.Size(10,17);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset);
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));

Note that if you pass an icon into the Marker constructor, it will take that icon and use it.  This means that you should not share icons between markers -- you use them once, but you should clone() for any additional markers using that same icon.

Summary
{OpenLayers.Icon} The icon used by this marker.
{OpenLayers.LonLat} location of object
{OpenLayers.Events} the event handler.
{OpenLayers.Map} the map this marker is attached to
Calls draw on the icon, and returns that output.
Move the marker to the new location.
{Boolean} Whether or not the marker is currently visible on screen.
Englarges the markers icon by the specified ratio.
Change the opacity of the marker by changin the opacity of its icon
Change URL of the Icon Image.
Hide or show the icon
Creates a default OpenLayers.Icon.

Properties

icon

{OpenLayers.Icon} The icon used by this marker.

lonlat

{OpenLayers.LonLat} location of object

events

{OpenLayers.Events} the event handler.

map

{OpenLayers.Map} the map this marker is attached to

Functions

OpenLayers. Marker

Parameters

lonlat{OpenLayers.LonLat} the position of this marker
icon{OpenLayers.Icon} the icon for this marker

draw

draw: function(px)

Calls draw on the icon, and returns that output.

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A new DOM Image with this marker’s icon set at the location passed-in

moveTo

moveTo: function (px)

Move the marker to the new location.

Parameters

px{OpenLayers.Pixel} the pixel position to move to

onScreen

onScreen:function()

Returns

{Boolean} Whether or not the marker is currently visible on screen.

inflate

inflate: function(inflate)

Englarges the markers icon by the specified ratio.

Parameters

inflate{float} the ratio to enlarge the marker by (passing 2 will double the size).

setOpacity

setOpacity: function(opacity)

Change the opacity of the marker by changin the opacity of its icon

Parameters

opacity{float} Specified as fraction (0.4, etc)

setUrl

setUrl: function(url)

Change URL of the Icon Image.

url{String}

display

display: function(display)

Hide or show the icon

display{Boolean}

defaultIcon

OpenLayers.Marker.defaultIcon = function()

Creates a default OpenLayers.Icon.

Returns

{OpenLayers.Icon} A default OpenLayers.Icon to use for a marker

OpenLayers. Popup. AnchoredBubble

Inherits from

Summary
{Boolean} Has the popup been rounded yet?
The popup has been moved to a new relative location, in which case we will want to re-do the rico corners.
Always sets border to 0.
Update RICO corners according to the popup’s current relative postion.
{String} The proper corners string (“tr tl bl br”) for rico to round.
{Integer} 5.

Properties

rounded

{Boolean} Has the popup been rounded yet?

Functions

OpenLayers. Popup. AnchoredBubble

Parameters

id{String}
lonlat{OpenLayers.LonLat}
contentSize{OpenLayers.Size}
contentHTML{String}
anchor{Object} Object to which we’ll anchor the popup.  Must expose a ‘size’ (OpenLayers.Size) and ‘offset’ (OpenLayers.Pixel) (Note that this is generally an OpenLayers.Icon).
closeBox{Boolean}
closeBoxCallback{Function} Function to be called on closeBox click.

draw

draw: function(px)

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} Reference to a div that contains the drawn popup.

updateRelativePosition

updateRelativePosition: function()

The popup has been moved to a new relative location, in which case we will want to re-do the rico corners.

setBorder

setBorder:function(border)

Always sets border to 0.  Bubble Popups can not have a border.

Parameters

border{Integer}

setRicoCorners

setRicoCorners:function()

Update RICO corners according to the popup’s current relative postion.

getCornersToRound

getCornersToRound:function()

Returns

{String} The proper corners string (“tr tl bl br”) for rico to round.

Constants

CORNER_SIZE

{Integer} 5.  Border space for the RICO corners.

OpenLayers. Renderer.SVG

Inherits

Summary
{String}
{String}
{Integer} Firefox has a limitation where values larger or smaller than about 15000 in an SVG document lock the browser up.
{Object} Hash with “x” and “y” properties
{Object} Cache for symbol sizes according to their svg coordinate space
See #669 for more information
Transforms the SVG coordinate system
Sets the size of the drawing surface.
Use to set all the style attributes to a SVG node.
{DOMElement} The specific render engine’s root element
{DOMElement} The main root element to which we’ll add vectors
{DOMElement} The element to which we’ll add the symbol definitions
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
This method is only called by the renderer itself.
Given two points (one inside the valid range, and one outside), clips the line betweeen the two points so that the new points are both inside the valid range.
Finds the position of an svg node.
add a new symbol definition from the rendererer’s symbol hash

Properties

xmlns

{String}

xlinkns

{String}

Constants

MAX_PIXEL

{Integer} Firefox has a limitation where values larger or smaller than about 15000 in an SVG document lock the browser up.  This works around it.

Properties

translationParameters

{Object} Hash with “x” and “y” properties

symbolSize

{Object} Cache for symbol sizes according to their svg coordinate space

Functions

OpenLayers. Renderer.SVG

Parameters

containerID{String}

inValidRange

inValidRange: function(x,
y,
xyOnly)

See #669 for more information

Parameters

x{Integer}
y{Integer}
xyOnly{Boolean} whether or not to just check for x and y, which means to not take the current translation parameters into account if true.

Returns

{Boolean} Whether or not the ‘x’ and ‘y’ coordinates are in the valid range.

setExtent

setExtent: function(extent,
resolutionChanged)

Parameters

extent{OpenLayers.Bounds}
resolutionChanged{Boolean}

Returns

{Boolean} true to notify the layer that the new extent does not exceed the coordinate range, and the features will not need to be redrawn.  False otherwise.

translate

translate: function(x,
y)

Transforms the SVG coordinate system

Parameters

x{Float}
y{Float}

Returns

{Boolean} true if the translation parameters are in the valid coordinates range, false otherwise.

setSize

setSize: function(size)

Sets the size of the drawing surface.

Parameters

size{OpenLayers.Size} The size of the drawing surface

getNodeType

getNodeType: function(geometry,
style)

Parameters

geometry{OpenLayers.Geometry}
style{Object}

Returns

{String} The corresponding node type for the specified geometry

setStyle

setStyle: function(node,
style,
options)

Use to set all the style attributes to a SVG node.

Takes care to adjust stroke width and point radius to be resolution-relative

Parameters

node{SVGDomElement} An SVG element to decorate
style{Object}
options{Object} Currently supported options include ‘isFilled’ {Boolean} and ‘isStroked’ {Boolean}

dashStyle

dashStyle: function(style,
widthFactor)

Parameters

style{Object}
widthFactor{Number}

Returns

{String} A SVG compliant ‘stroke-dasharray’ value

createNode

createNode: function(type,
id)

Parameters

type{String} Kind of node to draw
id{String} Id for node

Returns

{DOMElement} A new node of the given type and id

nodeTypeCompare

nodeTypeCompare: function(node,
type)

Parameters

node{SVGDomElement} An SVG element
type{String} Kind of node

Returns

{Boolean} Whether or not the specified node is of the specified type

createRenderRoot

createRenderRoot: function()

Returns

{DOMElement} The specific render engine’s root element

createRoot

createRoot: function()

Returns

{DOMElement} The main root element to which we’ll add vectors

createDefs

createDefs: function()

Returns

{DOMElement} The element to which we’ll add the symbol definitions

drawPoint

drawPoint: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the point

drawCircle

drawCircle: function(node,
geometry,
radius)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}
radius{Float}

Returns

{DOMElement} or false if the renderer could not draw the circle

drawLineString

drawLineString: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the linestring, or false if nothing could be drawn

drawLinearRing

drawLinearRing: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the linear ring, or false if nothing could be drawn

drawPolygon

drawPolygon: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the polygon, or false if nothing could be drawn

drawRectangle

drawRectangle: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the rectangle

drawSurface

drawSurface: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the surface

getComponentString

Parameters

components{Array(OpenLayers.Geometry.Point)} Array of points
separator{String} character between coordinate pairs.  Defaults to “,”

Returns

{Object} hash with properties “path” (the string created from the components and “complete” (false if the renderer was unable to draw all components)

clipLine

clipLine: function(badComponent,
goodComponent)

Given two points (one inside the valid range, and one outside), clips the line betweeen the two points so that the new points are both inside the valid range.

Parameters

badComponent{OpenLayers.Geometry.Point)} original geometry of the invalid point
goodComponent{OpenLayers.Geometry.Point)} original geometry of the valid point Returns {String} the SVG coordinate pair of the clipped point (like getShortString), or an empty string if both passed componets are at the same point.

getShortString

getShortString: function(point)

Parameters

point{OpenLayers.Geometry.Point}

Returns

{String} or false if point is outside the valid range

getPosition

getPosition: function(node)

Finds the position of an svg node.

Parameters

node{DOMElement}

Returns

{Object} hash with x and y properties, representing the coordinates within the svg coordinate system

importSymbol

importSymbol: function (graphicName)

add a new symbol definition from the rendererer’s symbol hash

Parameters

graphicName{String} name of the symbol to import

Returns

{String}id of the imported symbol

OpenLayers. Renderer.VML

Render vector features in browsers with VML capability.  Construct a new VML renderer with the OpenLayers.Renderer.VML constructor.

Note that for all calculations in this class, we use toFixed() to round a float value to an integer.  This is done because it seems that VML doesn’t support float values.

Inherits from

Summary
{String} XML Namespace URN
{DOMElement} node holding symbols.
{Object} Hash with “x” and “y” properties
Create a new VML renderer.
Set the renderer’s extent
Set the size of the drawing surface
Get the node type for a geometry and style
Use to set all the style attributes to a VML node.
If a point is to be styled with externalGraphic and rotation, VML fills cannot be used to display the graphic, because rotation of graphic fills is not supported by the VML implementation of Internet Explorer.
Some versions of Internet Explorer seem to be unable to set fillcolor and strokecolor to “none” correctly before the fill node is appended to a visible vml node.
Get the geometry’s bounds, convert it to our vml coordinate system, then set the node’s position, size, and local coordinate system.
Create a new node
Determine whether a node is of a given type
Create the renderer root
Create the main root element
Render a point
Render a circle.
Render a linestring.
Render a linearring
Render a line.
Render a polygon
Render a rectangle
add a new symbol definition from the rendererer’s symbol hash

Properties

xmlns

{String} XML Namespace URN

symbolCache

{DOMElement} node holding symbols.  This hash is keyed by symbol name, and each value is a hash with a “path” and an “extent” property.

offset

{Object} Hash with “x” and “y” properties

Functions

OpenLayers. Renderer.VML

Create a new VML renderer.

Parameters

containerID{String} The id for the element that contains the renderer

setExtent

setExtent: function(extent,
resolutionChanged)

Set the renderer’s extent

Parameters

extent{OpenLayers.Bounds}
resolutionChanged{Boolean}

Returns

{Boolean} true to notify the layer that the new extent does not exceed the coordinate range, and the features will not need to be redrawn.

setSize

setSize: function(size)

Set the size of the drawing surface

Parameters

size{OpenLayers.Size} the size of the drawing surface

getNodeType

getNodeType: function(geometry,
style)

Get the node type for a geometry and style

Parameters

geometry{OpenLayers.Geometry}
style{Object}

Returns

{String} The corresponding node type for the specified geometry

setStyle

setStyle: function(node,
style,
options,
geometry)

Use to set all the style attributes to a VML node.

Parameters

node{DOMElement} An VML element to decorate
style{Object}
options{Object} Currently supported options include ‘isFilled’ {Boolean} and ‘isStroked’ {Boolean}
geometry{OpenLayers.Geometry}

graphicRotate

graphicRotate: function(node,
xOffset,
yOffset)

If a point is to be styled with externalGraphic and rotation, VML fills cannot be used to display the graphic, because rotation of graphic fills is not supported by the VML implementation of Internet Explorer.  This method creates a olv:imagedata element inside the VML node, DXImageTransform.Matrix and BasicImage filters for rotation and opacity, and a 3-step hack to remove rendering artefacts from the graphic and preserve the ability of graphics to trigger events.  Finally, OpenLayers methods are used to determine the correct insertion point of the rotated image, because DXImageTransform.Matrix does the rotation without the ability to specify a rotation center point.

Parameters

node{DOMElement}
xOffset{Number} rotation center relative to image, x coordinate
yOffset{Number} rotation center relative to image, y coordinate

postDraw

postDraw: function(node)

Some versions of Internet Explorer seem to be unable to set fillcolor and strokecolor to “none” correctly before the fill node is appended to a visible vml node.  This method takes care of that and sets fillcolor and strokecolor again if needed.

Parameters

node{DOMElement}

setNodeDimension

setNodeDimension: function(node,
geometry)

Get the geometry’s bounds, convert it to our vml coordinate system, then set the node’s position, size, and local coordinate system.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

dashStyle

dashStyle: function(style)

Parameters

style{Object}

Returns

{String} A VML compliant ‘stroke-dasharray’ value

createNode

createNode: function(type,
id)

Create a new node

Parameters

type{String} Kind of node to draw
id{String} Id for node

Returns

{DOMElement} A new node of the given type and id

nodeTypeCompare

nodeTypeCompare: function(node,
type)

Determine whether a node is of a given type

Parameters

node{DOMElement} An VML element
type{String} Kind of node

Returns

{Boolean} Whether or not the specified node is of the specified type

createRenderRoot

createRenderRoot: function()

Create the renderer root

Returns

{DOMElement} The specific render engine’s root element

createRoot

createRoot: function()

Create the main root element

Returns

{DOMElement} The main root element to which we’ll add vectors

drawPoint

drawPoint: function(node,
geometry)

Render a point

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the point could not be drawn

drawCircle

drawCircle: function(node,
geometry,
radius)

Render a circle.  Size and Center a circle given geometry (x,y center) and radius

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}
radius{float}

Returns

{DOMElement} or false if the circle could not ne drawn

drawLineString

drawLineString: function(node,
geometry)

Render a linestring.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

drawLinearRing

drawLinearRing: function(node,
geometry)

Render a linearring

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

DrawLine

Render a line.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}
closeLine{Boolean} Close the line?  (make it a ring?)

Returns

{DOMElement}

drawPolygon

drawPolygon: function(node,
geometry)

Render a polygon

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

drawRectangle

drawRectangle: function(node,
geometry)

Render a rectangle

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

drawSurface

drawSurface: function(node,
geometry)

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

importSymbol

importSymbol: function (graphicName)

add a new symbol definition from the rendererer’s symbol hash

Parameters

graphicName{String} name of the symbol to import

Returns

{Object}hash of {DOMElement} “symbol” and {Number} “size”

OpenLayers. Tile. Image

Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.  Create a new image tile with the OpenLayers.Tile.Image constructor.

Inherits from

Summary
{String} The URL of the image being requested.
{DOMElement} The div element which wraps the image.
{DOMElement} The image element is appended to the frame.
{Boolean} True if the png alpha hack needs to be applied on the layer’s div.
{Boolean} Is this tile a back buffer tile?
{Float} Used in transition code only.
{Boolean} Is this the first time the tile is being drawn? 
{OpenLayers.Tile} A clone of the tile used to create transition effects when the tile is moved or changes resolution.
Constructor for a new OpenLayers.Tile.Image instance.
Check that a tile should be drawn, and draw it.
Triggered by two different events, layer loadend, and tile loadend.
Internal function to actually initialize the image tile, position it correctly, and set its url.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Creates the imgDiv property on the tile.
Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.
This method is invoked on tiles that are backBuffers for tiles in the grid.
Show the tile by showing its frame.
Hide the tile by hiding its frame.

Properties

url

{String} The URL of the image being requested.  No default.  Filled in by layer.getURL() function.

imgDiv

{DOMElement} The div element which wraps the image.

frame

{DOMElement} The image element is appended to the frame.  Any gutter on the image will be hidden behind the frame.

layerAlphaHack

{Boolean} True if the png alpha hack needs to be applied on the layer’s div.

isBackBuffer

{Boolean} Is this tile a back buffer tile?

lastRatio

{Float} Used in transition code only.  This is the previous ratio of the back buffer tile resolution to the map resolution.  Compared with the current ratio to determine if zooming occurred.

isFirstDraw

{Boolean} Is this the first time the tile is being drawn?  This is used to force resetBackBuffer to synchronize the backBufferTile with the foreground tile the first time the foreground tile loads so that if the user zooms before the layer has fully loaded, the backBufferTile for tiles that have been loaded can be used.

backBufferTile

{OpenLayers.Tile} A clone of the tile used to create transition effects when the tile is moved or changes resolution.

Functions

OpenLayers. Tile. Image

Constructor for a new OpenLayers.Tile.Image instance.

Parameters

layer{OpenLayers.Layer} layer that the tile will go in.
position{OpenLayers.Pixel}
bounds{OpenLayers.Bounds}
url{String} Deprecated.  Remove me in 3.0.
size{OpenLayers.Size}

clone

clone: function (obj)

Parameters

obj{OpenLayers.Tile.Image} The tile to be cloned

Returns

{OpenLayers.Tile.Image} An exact clone of this OpenLayers.Tile.Image

draw

draw: function()

Check that a tile should be drawn, and draw it.

Returns

{Boolean} Always returns true.

resetBackBuffer

resetBackBuffer: function()

Triggered by two different events, layer loadend, and tile loadend.  In any of these cases, we check to see if we can hide the backBufferTile yet and update its parameters to match the foreground tile.

Basic logic

  • If the backBufferTile hasn’t been drawn yet, reset it
  • If layer is still loading, show foreground tile but don’t hide the backBufferTile yet
  • If layer is done loading, reset backBuffer tile and show foreground tile

renderTile

renderTile: function()

Internal function to actually initialize the image tile, position it correctly, and set its url.

clear

clear: function()

Clear the tile of any bounds/position-related data so that it can be reused in a new location.

initImgDiv

initImgDiv: function()

Creates the imgDiv property on the tile.

checkImgURL

checkImgURL: function ()

Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.  If the tile URL did change before the image loaded, set the imgDiv display to ‘none’, as either (a) it will be reset to visible when the new URL loads in the image, or (b) we don’t want to display this tile after all because its new bounds are outside our maxExtent.

This function should no longer be neccesary with the improvements to Grid.js in OpenLayers 2.3.  The lack of a good isEquivilantURL function caused problems in 2.2, but it’s possible that with the improved isEquivilant URL function, this might be neccesary at some point.

See discussion in the thread at http://openlayers.org- /pipermail- /dev- /2007-January- /000205.html

startTransition

startTransition: function()

This method is invoked on tiles that are backBuffers for tiles in the grid.  The grid tile is about to be cleared and a new tile source loaded.  This is where the transition effect needs to be started to provide visual continuity.

show

show: function()

Show the tile by showing its frame.

hide

hide: function()

Hide the tile by hiding its frame.

OpenLayers. Control. OverviewMap

Create an overview map to display the extent of your main map and provide additional navigation control.  Create a new overview map with the OpenLayers.Control.OverviewMap constructor.

Inerits from

Summary
{DOMElement} The DOM element that contains the overview map
{Object}
{Object}
Create a new overview map
Render the control in the browser.
Handle extent rectangle drag
Handle browser events
Unhide the control.
Hide all the contents of the control, shrink the size, add the maximize icon
Hide/Show the toggle depending on whether the control is minimized
Update the overview map after layers move.
Determines if the overview map is suitable given the extent and resolution of the main map.
Construct the map that this control contains
Updates the extent rectangle position and size to match the map extent
Updates the map extent to match the extent rectangle position and size
Set extent rectangle pixel bounds.
Get the rect bounds from the map bounds.
Get the map bounds from the rect bounds.
Get a map location from a pixel location
Get a pixel location from a map location

Properties

element

{DOMElement} The DOM element that contains the overview map

handlers

{Object}

resolutionFactor

{Object}

Functions

OpenLayers. Control. OverviewMap

Create a new overview map

Parameters

object{Object} Properties of this object will be set on the overview map object.  Note, to set options on the map object contained in this control, set <mapOptions> as one of the options properties.

draw

draw: function()

Render the control in the browser.

baseLayerDraw

baseLayerDraw: function()
Draw the base layercalled if unable to complete in the initial draw

rectDrag

rectDrag: function(px)

Handle extent rectangle drag

Parameters

px{OpenLayers.Pixel} The pixel location of the drag.

mapDivClick

mapDivClick: function(evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

maximizeControl

maximizeControl: function(e)

Unhide the control.  Called when the control is in the map viewport.

Parameters

e{OpenLayers.Event}

minimizeControl

minimizeControl: function(e)

Hide all the contents of the control, shrink the size, add the maximize icon

Parameters

e{OpenLayers.Event}

showToggle

showToggle: function(minimize)

Hide/Show the toggle depending on whether the control is minimized

Parameters

minimize{Boolean}

update

update: function()

Update the overview map after layers move.

isSuitableOverview

isSuitableOverview: function()

Determines if the overview map is suitable given the extent and resolution of the main map.

createMap

createMap: function()

Construct the map that this control contains

updateRectToMap

updateRectToMap: function()

Updates the extent rectangle position and size to match the map extent

updateMapToRect

updateMapToRect: function()

Updates the map extent to match the extent rectangle position and size

setRectPxBounds

setRectPxBounds: function(pxBounds)

Set extent rectangle pixel bounds.

Parameters

pxBounds{OpenLayers.Bounds}

getRectBoundsFromMapBounds

getRectBoundsFromMapBounds: function(lonLatBounds)

Get the rect bounds from the map bounds.

Parameters

lonLatBounds{OpenLayers.Bounds}

Returns

{OpenLayers.Bounds}A bounds which is the passed-in map lon/lat extent translated into pixel bounds for the overview map

getMapBoundsFromRectBounds

getMapBoundsFromRectBounds: function(pxBounds)

Get the map bounds from the rect bounds.

Parameters

pxBounds{OpenLayers.Bounds}

Returns

{OpenLayers.Bounds} Bounds which is the passed-in overview rect bounds translated into lon/lat bounds for the overview map

getLonLatFromOverviewPx

getLonLatFromOverviewPx: function(overviewMapPx)

Get a map location from a pixel location

Parameters

overviewMapPx{OpenLayers.Pixel}

Returns

{OpenLayers.LonLat} Location which is the passed-in overview map OpenLayers.Pixel, translated into lon/lat by the overview map

getOverviewPxFromLonLat

getOverviewPxFromLonLat: function(lonlat)

Get a pixel location from a map location

Parameters

lonlat{OpenLayers.LonLat}

Returns

{OpenLayers.Pixel} Location which is the passed-in OpenLayers.LonLat, translated into overview map pixels

OpenLayers. Feature

Features are combinations of geography and attributes.  The OpenLayers.Feature class specifically combines a marker and a lonlat.

Summary
{String}
{Object}
Constructor for features.
nullify references to prevent circular references and memory leaks
{Boolean} Whether or not the feature is currently visible on screen (based on its ‘lonlat’ property)
Based on the data associated with the Feature, create and return a marker object.
Destroys marker.
Creates a popup object created from the ‘lonlat’, ‘popupSize’, and ‘popupContentHTML’ properties set in this.data.
Destroys the popup created via createPopup.

Properties

id

{String}

data

{Object}

Functions

OpenLayers. Feature

Constructor for features.

Parameters

layer{OpenLayers.Layer}
lonlat{OpenLayers.LonLat}
data{Object}

Returns

{OpenLayers.Feature}

destroy

destroy: function()

nullify references to prevent circular references and memory leaks

onScreen

onScreen:function()

Returns

{Boolean} Whether or not the feature is currently visible on screen (based on its ‘lonlat’ property)

createMarker

createMarker: function()

Based on the data associated with the Feature, create and return a marker object.

Returns

{OpenLayers.Marker} A Marker Object created from the ‘lonlat’ and ‘icon’ properties set in this.data.  If no ‘lonlat’ is set, returns null.  If no ‘icon’ is set, OpenLayers.Marker() will load the default image.

Notethis.marker is set to return value

destroyMarker

destroyMarker: function()

Destroys marker.  If user overrides the createMarker() function, s/he should be able to also specify an alternative function for destroying it

createPopup

createPopup: function(closeBox)

Creates a popup object created from the ‘lonlat’, ‘popupSize’, and ‘popupContentHTML’ properties set in this.data.  It uses this.marker.icon as default anchor.

If no ‘lonlat’ is set, returns null.  If no this.marker has been created, no anchor is sent.

Notethe returned popup object is ‘owned’ by the feature, so you cannot use the popup’s destroy method to discard the popup.  Instead, you must use the feature’s destroyPopup
Notethis.popup is set to return value

Parameters

closeBox{Boolean} create popup with closebox or not

Returns

{OpenLayers.Popup} Returns the created popup, which is also set as ‘popup’ property of this feature.  Will be of whatever type specified by this feature’s ‘popupClass’ property, but must be of type OpenLayers.Popup.

destroyPopup

destroyPopup: function()

Destroys the popup created via createPopup.

As with the marker, if user overrides the createPopup() function, s/he should also be able to override the destruction

OpenLayers. Handler. Click

A handler for mouse clicks.  The intention of this handler is to give controls more flexibility with handling clicks.  Browsers trigger click events twice for a double-click.  In addition, the mousedown, mousemove, mouseup sequence fires a click event.  With this handler, controls can decide whether to ignore clicks associated with a double click.  By setting a <pixelTolerance>, controls can also ignore clicks that include a drag.  Create a new instance with the OpenLayers.Handler.Click constructor.

Inherits from