OpenLayers is a JavaScript library, and as discussed earlier is built using Object Oriented Programming (OOP). When we want to actually create a layer, we will create (or instantiate) an object from an ol.layer.Layer
subclass.
OpenLayers has many different ol.layer
classes. The layer types are only for different kinds of data (tiles, images, and vector). Using an attached ol.source.*
will allow you to connect to a different type of map server 'back end.' Each layer object is independent of other layer objects; so, doing things to one layer won't necessarily affect the other.
Note
How many layers can I have?
The safest maximum amount of layers you can have on a map at one time depends largely on the user's machine (that is, their processing power and memory). Too many layers can also overwhelm users; many popular web maps (for example, Google and Yahoo!) contain just a few layers. We recommend that you don't use a lot of layers or limit the number of layers that you can...