s2js
    Preparing search index...

    Class ClosestCellQueryOptions

    Options that control the set of cells returned. Note that by default all cells are returned, so you will always want to set either the maxResults option or the maxDistance option (or both).

    Index

    Constructors

    Properties

    maxDistance: number = ...

    Specifies that only cells whose distance to the target is less than "maxDistance" should be returned.

    Note that cells whose distance is exactly equal to "maxDistance" are not returned. Normally this doesn't matter, because distances are not computed exactly in the first place, but if such cells are needed then see setInclusiveMaxDistance() below.

    Default: Infinity

    maxError: number = 0

    Specifies that cells up to maxError further away than the true closest cells may be substituted in the result set, as long as such cells satisfy all the remaining search criteria (such as maxDistance). This option only has an effect if maxResults is also specified; otherwise all cells closer than maxDistance will always be returned.

    Default: 0

    maxResults: number = Infinity

    Specifies that at most "maxResults" cells should be returned. Default: Infinity (no limit)

    region?: Region

    If specified, then only cells that intersect the given region are returned. This can be used to restrict the results to cells that intersect a given S2LatLngRect, for example.

    Default: undefined (no region restriction)

    Methods

    • Sets maxDistance such that cells whose true distance is less than or equal to maxDistance will be returned (along with some cells whose true distance is slightly greater).

      This ensures that all cells whose true distance is less than or equal to maxDistance will be returned. The maxDistance is increased by the maximum error in the distance calculation.

      Parameters

      • maxDistance: number

      Returns void

    • Sets maxDistance to the given value such that cells whose distance is exactly equal to maxDistance are also returned. Equivalent to setting maxDistance to maxDistance.successor().

      Parameters

      • maxDistance: number

      Returns void