All raster layers inherit from ol.layer.Layer.
The following table is the list of available properties. You can also use them with vector although it's not required in this chapter:
|
Name |
Type |
Description |
|---|---|---|
|
|
|
This property sets the layer brightness. See Wikipedia webpage (https://en.wikipedia.org/wiki/Brightness) for more information. |
|
|
| |
|
|
|
This property sets the layer hue. You can discover more about hue with the Wikipedia page, https://en.wikipedia.org/wiki/Hue. |
|
|
|
This property sets the layer opacity. Possible values are between |
|
|
|
This property sets the layer saturation. See the dedicated Wikipedia article (https://en.wikipedia.org/wiki/Colorfulness) for more. |
|
|
|
This property defines the source for the layer. Sources are a way to access a resource such as single, tiled images or geographic features. |
|
|
|
This property sets the visibility. The default value is |
|
|
|
This is the minimum resolution (inclusive) at which this layer will be visible. |
|
|
|
This is the maximum resolution (exclusive) below which this layer will be visible. |
You can use those properties to set layer properties at startup. If you need to change one of those properties after layer creation, you always have setters and getters. Getters, if you don't remember the part about JavaScript initialization, are methods of objects you can use to get properties. Setters are also methods but to set properties. The setter and getter for a property are derived from the property name. It starts with a get or set keyword followed by the property with the first letter using uppercase. For example, for opacity, the getter name is getOpacity and the setter name is setOpacity.
You also have some methods that are specific to ol.layer.Layer and not related to properties.
The following are the main methods. We will not cover methods related to events: the ol.layer.Layer inherits from ol.Object via ol.layer.Base (http://openlayers.org/en/v3.0.0/apidoc/ol.html). It's because we already explained how events works within Chapter 2, Key Concepts in OpenLayers.
Let's try to play with the simplest cases.