User Manual

Working with Layers

The Map Object provides a number of methods for working with layers namely:


usingLayer

The usingLayer method will grab an existing Layer Object that allows layer manipulation through a Fluent API that provides method chaining.


window.onload = function () {
    var map = new Mapzania.Map("map-div", "LONDON", function () {
        map.usingLayer("SIGHTS")
            .hide();
    });
};

usingNewLayer

The usingNewLayer method operates in a similar way to the usingLayer method. The only difference is that it does not use an existing layer, it creates a new layer.

NOTE: The layer created with usingNewLayer is a client-only layer. This means that it requires data to be added to it on the client. This is illustrated in the Feature Collection Filter Example.


window.onload = function () {
    var map = new Mapzania.Map("map-div", "LONDON", function () {
        map.usingNewLayer("MY_LAYER")
            .style({ fillColor: "#000000" });
    });
};

The following interactive example shows this in action: