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

usingNewLayer

Creates Layer Object with a key defined by the key parameter.

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

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.

Parameters

Name Required Description
key Yes The key for the new layer that will be created.

Example

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

  var geojson = {
    type: "FeatureCollection",
    features: [
      //... some feature data ...
    ]    
  };

    map.usingNewLayer("MY_LAYER")
      .addFeatureCollection(geojson)
      .filterByText("LandLocked=='Y'")
      .convertToCentroids()
      .style({ fillColor: "#0000FF"})
      .update();
});