JS API
Map Object
QueryEngine Object
Layer Object
Feature Object
Query Object
GeoJson Function Library (Experimental)

usingMapLayer

Gets a Query Object based on a layer of an existing Map Object.

It is used specifically to run queries based on the layers of an existing Map Object without interfering with the map itself.

This object is a fluent object and can be used to chain method calls to the query as per the example below.

Parameters

Name Required Description
map Yes An existing Map Object
layerKey Yes The key of the layer to be used in the query.
options No An object for custom configuration of the map-layer query. The possible options are shown in the section below.

Options

Name Default Description
useFilters true If set to true, the query will take into consideration any filters that have been applied to the map layer.
useState true If set to true, the query will take into consideration the state of the map layer. This includes any client-side features that have been added to the layer as well as whether the layer is visible or not.

Example

var map = new Mapzania.Map("map-div", "LONDON", function () {

    var qry = new Mapzania.QueryEngine();

    qry.usingMapLayer(map, "WARD", { 
            useState: false, 
            useFilters: true 
        })
        .convertToCentroids()
        .apply()
        .then(function (data) {
            console.log(data);
        });
});