nearest filter

This example loads a map of Africa using the "AFRICA" key.

The "AFRICA" map was created using the Mapzania MapStyler (see www.mapzania.com/manual/concepts-mapstyler).

The example uses the "usingLayer" method of the Mapzania Map object to get a "COUNTRIES" Layer Object and make chained calls to the "filterByNearest" and then the "update" method of the layer to filter and redraw the layer data.

For more on layers see: www.mapzania.com/manual/concepts-layers

For more on the Layer Object and applicable methods see:

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

        var point = {
            type: "Point",
            coordinates: [0, 0]

            .filterByNearest(point, { take: 5 })

        // Draw the filter's point on a new layer

        var GJ = Mapzania.GeoJson;

        var feature = GJ.createFeature(point);
        var featureCollection = GJ.createFeatureCollection(feature);

            .style({ fillColor: "#FFFF00", size: 12 })

#map-div {
    position: absolute;
    top: 0px;
    left: 0px;
    bottom: 0px;
    right: 0px;
<div id="map-div"></div>