User Manual

Displaying Layers

The Layer Object provides a number of methods for setting the layer display namely:


show/hide

The show and hide methods change the visibility of the layer.


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

update

The update method will redraw the layer once a number of changes have been made to the layer.


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

The following interactive example shows this in action: