ejsGeoPolygonFilter

A filter for locating documents that fall within a polygon of points. Simply provide a lon/lat for each document as a Geo Point type. The format conforms with the GeoJSON specification.

Module

 GeoPolygonFilter

GeoPolygonFilter ( fieldName )
Filter results to those which are contained within the polygon of points.

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.
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
Objectpoints(pointsArray)Sets a series of points that represent a polygon. If passed a single GeoPoint object, it is added to the current list of points. If passed an array of GeoPoint objects it replaces all current values.
ObjecttoJSON()Returns the filter object.

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.

 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.

 points

Object points ( pointsArray )
Sets a series of points that represent a polygon. If passed a single GeoPoint object, it is added to the current list of points. If passed an array of GeoPoint objects it replaces all current values.

Parameters
pointsArray <Array> the array of points that represent the polygon
Returns
returns this so that calls can be chained.

 toJSON

Object toJSON ( )
Returns the filter object.

Returns
filter object

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo