• API

    Show / Hide Table of Contents

    Class SpatialPrefixTree

    A spatial Prefix Tree, or Trie, which decomposes shapes into prefixed strings at variable lengths corresponding to variable precision.

    Inheritance
    System.Object
    SpatialPrefixTree
    GeohashPrefixTree
    QuadPrefixTree
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.Spatial.Prefix.Tree
    Assembly: Lucene.Net.Spatial.dll
    Syntax
    public abstract class SpatialPrefixTree
    Remarks

    A spatial Prefix Tree, or Trie, which decomposes shapes into prefixed strings at variable lengths corresponding to variable precision. Each string corresponds to a rectangular spatial region. This approach is also referred to "Grids", "Tiles", and "Spatial Tiers".

    Implementations of this class should be thread-safe and immutable once initialized.

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk

    Constructors

    | Improve this Doc View Source

    SpatialPrefixTree(SpatialContext, Int32)

    Declaration
    public SpatialPrefixTree(SpatialContext ctx, int maxLevels)
    Parameters
    Type Name Description
    Spatial4n.Core.Context.SpatialContext ctx
    System.Int32 maxLevels

    Fields

    | Improve this Doc View Source

    m_ctx

    Declaration
    protected readonly SpatialContext m_ctx
    Field Value
    Type Description
    Spatial4n.Core.Context.SpatialContext
    | Improve this Doc View Source

    m_maxLevels

    Declaration
    protected readonly int m_maxLevels
    Field Value
    Type Description
    System.Int32

    Properties

    | Improve this Doc View Source

    MaxLevels

    Declaration
    public virtual int MaxLevels { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    SpatialContext

    Declaration
    public virtual SpatialContext SpatialContext { get; }
    Property Value
    Type Description
    Spatial4n.Core.Context.SpatialContext
    | Improve this Doc View Source

    WorldCell

    Returns the level 0 cell which encompasses all spatial data.

    Declaration
    public virtual Cell WorldCell { get; }
    Property Value
    Type Description
    Cell
    Remarks

    Returns the level 0 cell which encompasses all spatial data. Equivalent to GetCell(String) with System.String.Empty. This cell is threadsafe, just like a spatial prefix grid is, although cells aren't generally threadsafe.

    Methods

    | Improve this Doc View Source

    CellsToTokenStrings(ICollection<Cell>)

    Will add the trailing leaf byte for leaves. This isn't particularly efficient.

    Declaration
    [Obsolete("TODO remove; not used and not interesting, don't need collection in & out")]
    public static IList<string> CellsToTokenStrings(ICollection<Cell> cells)
    Parameters
    Type Name Description
    System.Collections.Generic.ICollection<Cell> cells
    Returns
    Type Description
    System.Collections.Generic.IList<System.String>
    | Improve this Doc View Source

    GetCell(IPoint, Int32)

    Returns the cell containing point p at the specified level.

    Declaration
    protected virtual Cell GetCell(IPoint p, int level)
    Parameters
    Type Name Description
    Spatial4n.Core.Shapes.IPoint p
    System.Int32 level
    Returns
    Type Description
    Cell
    | Improve this Doc View Source

    GetCell(Byte[], Int32, Int32)

    Declaration
    public abstract Cell GetCell(byte[] bytes, int offset, int len)
    Parameters
    Type Name Description
    System.Byte[] bytes
    System.Int32 offset
    System.Int32 len
    Returns
    Type Description
    Cell
    | Improve this Doc View Source

    GetCell(Byte[], Int32, Int32, Cell)

    Declaration
    public Cell GetCell(byte[] bytes, int offset, int len, Cell target)
    Parameters
    Type Name Description
    System.Byte[] bytes
    System.Int32 offset
    System.Int32 len
    Cell target
    Returns
    Type Description
    Cell
    | Improve this Doc View Source

    GetCell(String)

    The cell for the specified token.

    Declaration
    public abstract Cell GetCell(string token)
    Parameters
    Type Name Description
    System.String token
    Returns
    Type Description
    Cell
    Remarks

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

    | Improve this Doc View Source

    GetCells(IPoint, Int32, Boolean)

    A Point-optimized implementation of GetCells(IShape, Int32, Boolean, Boolean). That method in facts calls this for points.

    This implementation depends on GetCell(String) being fast, as its called repeatedly when incPlarents is true.

    Declaration
    public virtual IList<Cell> GetCells(IPoint p, int detailLevel, bool inclParents)
    Parameters
    Type Name Description
    Spatial4n.Core.Shapes.IPoint p
    System.Int32 detailLevel
    System.Boolean inclParents
    Returns
    Type Description
    System.Collections.Generic.IList<Cell>
    | Improve this Doc View Source

    GetCells(IShape, Int32, Boolean, Boolean)

    Gets the intersecting cells for the specified shape, without exceeding detail level.

    Declaration
    public virtual IList<Cell> GetCells(IShape shape, int detailLevel, bool inclParents, bool simplify)
    Parameters
    Type Name Description
    Spatial4n.Core.Shapes.IShape shape

    the shape; non-null

    System.Int32 detailLevel

    the maximum detail level to get cells for

    System.Boolean inclParents

    if true then all parent cells of leaves are returned too. The top world cell is never returned.

    System.Boolean simplify

    for non-point shapes, this will simply/aggregate sets of complete leaves in a cell to its parent, resulting in ~20-25% fewer cells.

    Returns
    Type Description
    System.Collections.Generic.IList<Cell>

    a set of cells (no dups), sorted, immutable, non-null

    Remarks

    Gets the intersecting cells for the specified shape, without exceeding detail level. If a cell is within the query shape then it's marked as a leaf and none of its children are added.

    This implementation checks if shape is a Spatial4n.Core.Shapes.IPoint and if so returns GetCells(IPoint, Int32, Boolean).

    | Improve this Doc View Source

    GetDistanceForLevel(Int32)

    Given a cell having the specified level, returns the distance from opposite corners.

    Declaration
    public virtual double GetDistanceForLevel(int level)
    Parameters
    Type Name Description
    System.Int32 level

    [1 to maxLevels]

    Returns
    Type Description
    System.Double

    0

    Remarks

    Given a cell having the specified level, returns the distance from opposite corners. Since this might very depending on where the cell is, this method may over-estimate.

    | Improve this Doc View Source

    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 abstract int GetLevelForDistance(double dist)
    Parameters
    Type Name Description
    System.Double dist

    = 0

    Returns
    Type Description
    System.Int32

    level [1 to maxLevels]

    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.

    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)