Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class GeohashPrefixTree

    A SpatialPrefixTree based on Geohashes. Uses Spatial4n.Util.GeohashUtils to do all the geohash work.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    object
    SpatialPrefixTree
    GeohashPrefixTree
    Inherited Members
    SpatialPrefixTree.m_maxLevels
    SpatialPrefixTree.m_ctx
    SpatialPrefixTree.SpatialContext
    SpatialPrefixTree.MaxLevels
    SpatialPrefixTree.ToString()
    SpatialPrefixTree.GetDistanceForLevel(int)
    SpatialPrefixTree.WorldCell
    SpatialPrefixTree.GetCell(byte[], int, int, Cell)
    SpatialPrefixTree.GetCells(IShape, int, bool, bool)
    SpatialPrefixTree.GetCells(IPoint, int, bool)
    SpatialPrefixTree.CellsToTokenStrings(ICollection<Cell>)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Spatial.Prefix.Tree
    Assembly: Lucene.Net.Spatial.dll
    Syntax
    public class GeohashPrefixTree : SpatialPrefixTree

    Constructors

    GeohashPrefixTree(SpatialContext, int)

    Initializes a new instance of GeohashPrefixTree with the specified spatial context (ctx) and maxLevels.

    Declaration
    public GeohashPrefixTree(SpatialContext ctx, int maxLevels)
    Parameters
    Type Name Description
    SpatialContext ctx

    The spatial context.

    int maxLevels

    The maximum number of levels in the tree.

    Exceptions
    Type Condition
    ArgumentNullException

    ctx is null.

    ArgumentOutOfRangeException

    maxLevels is less than or equal to 0 or greater than MaxLevelsPossible.

    Properties

    MaxLevelsPossible

    Any more than this and there's no point (double lat & lon are the same).

    Declaration
    public static int MaxLevelsPossible { get; }
    Property Value
    Type Description
    int

    Methods

    GetCell(IPoint, int)

    Returns the cell containing point p at the specified level.

    Declaration
    protected override Cell GetCell(IPoint p, int level)
    Parameters
    Type Name Description
    IPoint p
    int level
    Returns
    Type Description
    Cell
    Overrides
    SpatialPrefixTree.GetCell(IPoint, int)

    GetCell(byte[], int, int)

    A SpatialPrefixTree based on Geohashes. Uses Spatial4n.Util.GeohashUtils to do all the geohash work.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public override Cell GetCell(byte[] bytes, int offset, int len)
    Parameters
    Type Name Description
    byte[] bytes
    int offset
    int len
    Returns
    Type Description
    Cell
    Overrides
    SpatialPrefixTree.GetCell(byte[], int, int)

    GetCell(string)

    The cell for the specified token.

    Declaration
    public override Cell GetCell(string token)
    Parameters
    Type Name Description
    string token
    Returns
    Type Description
    Cell
    Overrides
    SpatialPrefixTree.GetCell(string)
    Remarks

    The cell for the specified token. The empty string should be equal to WorldCell. Precondition: Never called when token length > maxLevel.

    GetLevelForDistance(double)

    Returns the level of the largest grid in which its longest side is less than or equal to the provided distance (in degrees).

    Declaration
    public override int GetLevelForDistance(double dist)
    Parameters
    Type Name Description
    double dist

    = 0

    Returns
    Type Description
    int

    level [1 to maxLevels]

    Overrides
    SpatialPrefixTree.GetLevelForDistance(double)
    Remarks

    Returns the level of the largest grid in which its longest side is less than or equal to the provided distance (in degrees). Consequently dist acts as an error epsilon declaring the amount of detail needed in the grid, such that you can get a grid with just the right amount of precision.

    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.