filter by geo distance

This block is part of the array group and was last modified in core v15.0.0.

filter by geo distance v14.0.5 Updated v15.0.0

Filters an array of objects, keeping only items where the from location is within the distance specified by each item's distance field. The distance unit (km or m) is configurable.

In pins 6
  • Array required
    array

    Array of objects containing a location and a distance field.

  • From location required
    geo_point

    The origin location to measure distance from.

  • Distance key required
    value

    The field path in each object that holds the max distance, expressed in the unit chosen below (e.g. distance_km).

  • Location key required
    value

    The field path in each object that holds the geo point (e.g. location.location). Expects { lat, lon }.

  • Location fallback key v15.0.0
    value

    Optional second field path on the same object, used when the primary location key has no valid { lat, lon }.

  • Distance unit v15.0.0
    value

    Unit the distance field is expressed in: km (kilometers, default) or m (meters). Defaults to km when empty. • Suggestions: km m

    Default km

Out pins 2
  • Within range
    array

    Items where the from location is within the item's distance.

  • Out of range
    array

    Items where the from location is NOT within the item's distance.

Splits items by great-circle distance from from_location: an item goes to array (within range) when its location_key point, or failing that its location_fallback_key point, lies within the item's OWN distance_key value expressed in distance_unit (default km). Non-object items, items with a non-numeric distance, and items with no valid location go to out_of_range. On invalid from_location or missing key configuration the block FAILS CLOSED: every item goes to out_of_range.

geo
radius
nearby
within range

A typical wiring for filter by geo distance: value feeds the distance_key pin; remove fields feeds the array pin; search feeds the location_key pin; from city feeds the from_location pin; the array out pin feeds select fields.

Studio canvas example for the filter by geo distance block: typical wiring for filter by geo distance.

Commonly used with

In production blueprints, this block is most often wired together with:

  • value: feeds into this block. Simply returns the provided value.
  • select fields: this block feeds into it. Filters all other fields from the objects in this array.
  • remove fields: feeds into this block. Removes the specified fields from the objects in this array. Each object is deep-copied first, so the input array and its objects are not mutated.
  • return: this block feeds into it. Returns the added custom pins as data-pins on the function execute.
  • search: feeds into this block. searches in the given storage based on a query.
  • get fields: feeds into this block. Gets the selected fields from the given object.

Used in these guides

These documentation pages use or explain this block:

Version history

Introduced in v14.0.5.

Last modified in v15.0.0.


Back to array Return to the main group to view all sub-groups Back to array Return to the group to view all blocks within this group