# Hooks
# Query
# asGeoJson(options)
Return a hook function according to provided options
Transform the hook results into a GeoJson (opens new window) object:
- force: set to
true
to perform transformation whatever hook parameters, otherwise this hook will only be run whenhook.params.asGeoJson
istrue
(default) - longitudeProperty: name of the field where to read the longitude on result items
- latitudeProperty: name of the field where to read the latitude on result items
- altitudeProperty: name of the field where to read the altitude on result items
- pick: an array of properties to be picked on result items using Lodash (opens new window)
- omit: an array of properties to be omitted on result items using Lodash (opens new window)
- properties: a map between input key path and output key path supporting dot notation, a value of the map is a structure like this:
- from: input key path
- to: output key path (defaults to input path if not given)
- delete: boolean indicating if the input key path should be deleted or not after mapping
- asFeatureCollection: true to output a GeoJson feature collection (opens new window) (default) otherwise will generate an array of GeoJson features (opens new window)
# marshallSpatialQuery(hook)
Converts from client/server side spatial types (e.g. coordinates or numbers) to basic JS types, which is usually required when querying the database. Applies to MongoDB geospatial operators (opens new window). It also manages shortcuts to create spatial queries for features in a given area.
Also set hook.params.asGeoJson
to true
when hook.query.geoJson
is true
(see above).
# aggregateFeaturesQuery(hook)
Constructs query for feature aggregation over time.
Reads the query object to process from
hook.params.query.$aggregate
← Services Components →