ejsGeoDistanceFilter

A filter that restricts matched results/docs to a given distance from the point of origin. The format conforms with the GeoJSON specification.

Module

 GeoDistanceFilter

GeoDistanceFilter ( fieldName )
Filter results to those which fall within the given distance of the point of origin.

Parameters
fieldName <String> the document property/field containing the Geo Point (lon/lat).

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectcache(trueFalse)Enable or disable caching of the filter
ObjectcacheKey(key)Sets the cache key.
Objectdistance(numericDistance)Sets the numeric distance to be used. The distance can be a numeric value, and then the unit (either mi or km can be set) controlling the unit. Or a single string with the unit as well.
ObjectdistanceType(type)How to compute the distance. Can either be arc (better precision) or plane (faster). Defaults to arc.
Objectfield(f)Sets the fields to filter against.
Objectname(name)Sets the filter name.
Objectnormalize(trueFalse)If the lat/long points should be normalized to lie within their respective normalized ranges. Normalized ranges are: lon = -180 (exclusive) to 180 (inclusive) range lat = -90 to 90 (both inclusive) range
ObjectoptimizeBbox(t)Will an optimization of using first a bounding box check will be used. Defaults to memory which will do in memory checks. Can also have values of indexed to use indexed value check, or none which disables bounding box optimization.
Objectpoint(p)Sets the point of origin in which distance will be measured from
ObjecttoJSON()Returns the filter object.
Objectunit(unit)Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km".

Method Detail

 _type

String _type ( )
The type of ejs object. For internal use only.

Returns
the type of object

 cache

Object cache ( trueFalse )
Enable or disable caching of the filter

Parameters
trueFalse <Boolean> True to cache the filter, false otherwise.
Returns
returns this so that calls can be chained.

 cacheKey

Object cacheKey ( key )
Sets the cache key.

Parameters
key <String> the cache key as a string.
Returns
returns this so that calls can be chained.

 distance

Object distance ( numericDistance )
Sets the numeric distance to be used. The distance can be a numeric value, and then the unit (either mi or km can be set) controlling the unit. Or a single string with the unit as well.

Parameters
numericDistance <Number> the numeric distance
Returns
returns this so that calls can be chained.

 distanceType

Object distanceType ( type )
How to compute the distance. Can either be arc (better precision) or plane (faster). Defaults to arc.

Parameters
type <String> The execution type as a string.
Returns
returns this so that calls can be chained.

 field

Object field ( f )
Sets the fields to filter against.

Parameters
f <String> A valid field name.
Returns
returns this so that calls can be chained.

 name

Object name ( name )
Sets the filter name.

Parameters
name <String> A name for the filter.
Returns
returns this so that calls can be chained.

 normalize

Object normalize ( trueFalse )
If the lat/long points should be normalized to lie within their respective normalized ranges. Normalized ranges are: lon = -180 (exclusive) to 180 (inclusive) range lat = -90 to 90 (both inclusive) range

Parameters
trueFalse <String> True if the coordinates should be normalized. False otherwise.
Returns
returns this so that calls can be chained.

 optimizeBbox

Object optimizeBbox ( t )
Will an optimization of using first a bounding box check will be used. Defaults to memory which will do in memory checks. Can also have values of indexed to use indexed value check, or none which disables bounding box optimization.

Parameters
t <String> optimization type of memory, indexed, or none.
Returns
returns this so that calls can be chained.

 point

Object point ( p )
Sets the point of origin in which distance will be measured from

Parameters
p <GeoPoint> A valid GeoPoint object.
Returns
returns this so that calls can be chained.

 toJSON

Object toJSON ( )
Returns the filter object.

Returns
filter object

 unit

Object unit ( unit )
Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km".

Parameters
unit <Number> the unit of distance measure.
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo