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.
Inherited Members
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 |
|
ArgumentOutOfRangeException |
|
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
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
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
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 |
|
Returns
Type | Description |
---|---|
int | level [1 to maxLevels] |
Overrides
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.