JS API
- Parameters
- Options
- Example
- Methods
- fitToBoundingBox
- getBoundingBox
- getInitialBoundingBox
- getLayers
- getMouseMode
- off
- on
- once
- refresh
- reset
- setMouseMode
- usingLayer
- usingNewLayer
- Events
- Parameters
- Example
- Methods
- addFeature
- addFeatureCollection
- bringForwards
- bufferGeometry
- changeProperties
- clearFilters
- clearFeatures
- clearStyle
- clipByFeatureCollection
- convertToCentroids
- filterByBoundingBox
- filterByFeatureCollection
- filterByNearest
- filterByText
- getFeatureCollection
- hide
- sendBackwards
- show
- style
- update
- usingFeature
filterByNearest
Creates an filter that filters features based on their proximity to a point (latitude, longitude).
Parameters
Name | Required | Description |
---|---|---|
point | Yes | The GeoJSON Point from which to test proximity. latitude value of the coordinate. |
options | No | An object for the configuration of the filterByNearest filter. The possible options are shown in the section below. |
Options
Name | Default | Description |
---|---|---|
take | 1 | The number of features to return. |
includeDistance | false | If this is true, the distance to each feature is added as a property to the feature |
Example
var qry = new Mapzania.QueryEngine();
qry.usingLayerSource("COUNTRIES")
.filterByNearest({type:"Point", coordinates:[10.2, -12.5]}, {take:3})
.apply()
.then(function(data){
console.log(data);
});