Lazy source example

Example of setting a layer source after construction.

Typically, the source for a layer is provided to the layer constructor. If you need to set a layer source after construction, this can be done with the layer.setSource() method.

The layer in the map above is constructed with no source. Use the links below to set/unset the layer source. A layer is not rendered until its source is set.

See the lazy-source.js source for details on how this is done.

source