Optional
options: WazeFeatureLayerOptions<Feature>If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.
If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.
Attribution string, displayed when an <OpenLayers.Control.Attribution> has been added to the map.
Display the layer's name in the layer switcher. Default is true
Request map tiles that are completely outside of the max extent for this layer. Defaults to false.
An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.
APIProperty: events {<OpenLayers.Events>}
Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)
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 layer.events.object. element - {DOMElement} A reference to layer.events.element.
Supported map event types:
loadstart - Triggered when layer loading starts. When using a Vector
layer with a Fixed or BBOX strategy, the event object includes
a filter property holding the OpenLayers.Filter used when
calling read on the protocol.
loadend - Triggered when layer loading ends. When using a Vector layer
with a Fixed or BBOX strategy, the event object includes a
response property holding an OpenLayers.Protocol.Response object.
visibilitychanged - Triggered when the layer's visibility property is
changed, e.g. by turning the layer on or off in the layer switcher.
Note that the actual visibility of the layer can also change if it
gets out of range (see
Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.
For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.
The current map resolution is within the layer's min/max range. This is set in <OpenLayers.Map.setCenter> whenever the zoom changes.
Whether or not the layer is a base layer. This should be set individually by all subclasses. Default is false
This variable is set when the layer is added to the map, via the accessor function setMap()
The maximum extent for the layer. Defaults to null.
Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default <OpenLayers.Map.tileSize> and displaying the whole world.
This object can be used to store additional information on a layer object.
The minimum extent for the layer. Defaults to null.
The layer's opacity. Float number between 0.0 and 1.0.
An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.
Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.
The properties that are used for calculating resolutions information.
A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).
An array of map scales in descending order. The values in the
array correspond to the map scale denominator. Note that these
values only make sense if the display (monitor) resolution of the
client is correctly guessed by whomever is configuring the
application. In addition, the units property must also be set.
Use
APIProperty: style {Object} Default style for the layer
Property: styleMap {<OpenLayers.StyleMap>}
The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.
The layer should be displayed in the map. Default is true.
Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.
Static
CLASS_APIMethod: addOptions
Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.
Method: adjustBounds 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. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.
Parameters: bounds - {<OpenLayers.Bounds>}
APIMethod: calculateInRange
Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.
Method: calculateResolutions Calculate resolutions based on the provided properties.
Parameters: props - {Object} Properties
Returns: {Array({Number})} Array of resolutions.
Method: clone
Parameters: obj - {<OpenLayers.Layer>} The layer to be cloned
Returns: {<OpenLayers.Layer>} An exact clone of this <OpenLayers.Layer>
Optional
obj: anyMethod: destroy Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own.
Parameters: setNewBaseLayer - {Boolean} Set a new base layer when this layer has been destroyed. Default is true.
APIMethod: destroyFeatures Erase and destroy features on the layer.
Parameters: features - {Array(<OpenLayers.Feature.Vector>)} An optional array of features to destroy. If not supplied, all features on the layer will be destroyed. options - {Object}
APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..
Parameters: display - {Boolean}
APIMethod: drawFeature Draw (or redraw) a feature on the layer. If the optional style argument is included, this style will be used. If no style is included, the feature's style will be used. If the feature doesn't have a style, the layer's style will be used.
This function is not designed to be used when adding features to the layer (use addFeatures instead). It is meant to be used when the style of a feature has changed, or in some other way needs to visually updated after it has already been added to a layer. You must add the feature to the layer for most layer-related events to happen.
Parameters: feature - {<OpenLayers.Feature.Vector>} style - {String | Object} Named render intent or full symbolizer object.
Optional
style: string | SymbolizerAPIMethod: getExtent
Returns: {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat bounds of the current viewPort.
APIMethod: getFeatureByFid Given a feature fid, return the feature if it exists in the features array
Parameters: featureFid - {String}
Returns: {<OpenLayers.Feature.Vector>} A feature corresponding to the given featureFid or null if there is no such feature.
APIMethod: getFeatureById Given a feature id, return the feature if it exists in the features array
Parameters: featureId - {String}
Returns: {<OpenLayers.Feature.Vector>} A feature corresponding to the given featureId or null if there is no such feature.
Method: getFeatureFromEvent Given an event, return a feature if the event occurred over one. Otherwise, return null.
Parameters: evt - {Event}
Returns: {<OpenLayers.Feature.Vector>} A feature if one was under the event.
APIMethod: getFeaturesByAttribute Returns an array of features that have the given attribute key set to the given value. Comparison of attribute values takes care of datatypes, e.g. the string '1234' is not equal to the number 1234.
Parameters: attrName - {String} attrValue - {Mixed}
Returns: Array({<OpenLayers.Feature.Vector>}) An array of features that have the passed named attribute set to the given value.
APIMethod: getImageSize
Parameters: bounds - {<OpenLayers.Bounds>} optional tile bounds, can be used by subclasses that have to deal with different tile sizes at the layer extent edges (e.g. Zoomify)
Returns: {<OpenLayers.Size>} The size that the image should be, taking into account gutters.
APIMethod: getLonLatFromViewPortPx
Parameters: viewPortPx - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
Returns: {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view port <OpenLayers.Pixel>, translated into lon/lat by the layer.
APIMethod: getResolution
Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.
APIMethod: getResolutionForZoom
Parameters: zoom - {Float}
Returns: {Float} A suitable resolution for the specified zoom.
APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.
Parameters: lonlat - {<OpenLayers.LonLat>|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.
Returns: {<OpenLayers.Pixel>} An <OpenLayers.Pixel> which is the passed-in lonlat translated into view port pixels.
Method: getVisibility Determine whether the feature is displayed or not. It may not displayed because: - its style display property is set to 'none', - it doesn't belong to any layer, - the styleMap creates a symbolizer with display property set to 'none' for it, - the layer which it belongs to is not visible.
Returns: {Boolean} The feature is currently displayed.
Find an SVG element for a Waze Feature.
an id of a Waze Feature to look for a DOM element for
an SVG element of the feature or null if not rendered
Method: getZIndex
Returns: {Integer} the z-index of this layer
APIMethod: getZoomForExtent
Parameters: extent - {<OpenLayers.Bounds>} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.
Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.
Optional
closest: booleanAPIMethod: getZoomForResolution
Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.
Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.
Optional
closest: booleanOptional
isSelected: booleanMethod: initResolutions 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.
The user has several options that determine how the array is set up.
For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels
Method: moveByPx Move the layer based on pixel vector. To be implemented by subclasses.
Parameters: dx - {Number} The x coord of the displacement vector. dy - {Number} The y coord of the displacement vector.
Method: moveTo
Parameters: bounds - {<OpenLayers.Bounds>} zoomChanged - {Boolean} Tells when zoom has changed, as layers have to do some init work in that case. dragging - {Boolean}
This function can be implemented by subclasses
APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.
Returns: {Boolean} The layer was redrawn.
Method: refresh Ask the layer to request features again and redraw them. Triggers the refresh event if the layer is in range and visible.
Parameters: obj - {Object} Optional object with properties for any listener of the refresh event.
Optional
obj: ObjectAPIMethod: removeAllFeatures Remove all features from the layer.
Parameters: options - {Object} Optional properties for changing behavior of the removal.
Valid options: silent - {Boolean} Supress event triggering. Default is false.
Optional
options: { silent: boolean }APIMethod: removeFeatures Remove features from the layer. This erases any drawn features and removes them from the layer's control. The beforefeatureremoved and featureremoved events will be triggered for each feature. The featuresremoved event will be triggered after all features have been removed. To supress event triggering, use the silent option.
Parameters: features - {Array(<OpenLayers.Feature.Vector>)} List of features to be removed. options - {Object} Optional properties for changing behavior of the removal.
Valid options: silent - {Boolean} Supress event triggering. Default is false.
APIMethod: removeMap Just as setMap() allows each layer the possibility to take a personalized action on being added to the map, removeMap() allows each layer to take a personalized action on being removed from it. For now, this will be mostly unused, except for the EventPane layer, which needs this hook so that it can remove the special invisible pane.
Parameters: map - {<OpenLayers.Map>}
APIMethod: setIsBaseLayer
Parameters: isBaseLayer - {Boolean}
Method: setMap Set the map property for the layer. This is done through an accessor so that subclasses can override this and take special action once they have their map variable set.
Here we take care to bring over any of the necessary default properties from the map.
Parameters: map - {<OpenLayers.Map>}
APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.
Parameters: newName - {String} The new name.
APIMethod: setOpacity Sets the opacity for the entire layer (all images)
Parameters: opacity - {Float}
APIMethod: setTileSize Set the tile size based on the map size. This also sets layer.imageSize or use by Tile.Image.
Parameters: size - {<OpenLayers.Size>}
APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified
Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.
Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)
Method: setZIndex
Parameters: zIndex - {Integer}
Optional
isSelected: boolean
The layer's images have an alpha channel. Default is false.