public class GeohashPrefixTree extends SpatialPrefixTree
Modifier and Type | Class and Description |
---|---|
static class |
GeohashPrefixTree.Factory
Factory for creating
GeohashPrefixTree instances with useful defaults |
ctx, maxLevels, UTF8
Constructor and Description |
---|
GeohashPrefixTree(com.spatial4j.core.context.SpatialContext ctx,
int maxLevels) |
Modifier and Type | Method and Description |
---|---|
int |
getLevelForDistance(double dist)
Returns the level of the largest grid in which its longest side is less
than or equal to the provided distance (in degrees).
|
static int |
getMaxLevelsPossible()
Any more than this and there's no point (double lat & lon are the same).
|
Node |
getNode(byte[] bytes,
int offset,
int len) |
Node |
getNode(com.spatial4j.core.shape.Point p,
int level) |
Node |
getNode(String token)
The cell for the specified token.
|
List<Node> |
getNodes(com.spatial4j.core.shape.Shape shape,
int detailLevel,
boolean inclParents)
Gets the intersecting & including cells for the specified shape, without exceeding detail level.
|
getMaxLevels, getNode, getNodesAltPoint, getSpatialContext, getWorldNode, nodesToTokenStrings, toString
public GeohashPrefixTree(com.spatial4j.core.context.SpatialContext ctx, int maxLevels)
public static int getMaxLevelsPossible()
public int getLevelForDistance(double dist)
SpatialPrefixTree
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.getLevelForDistance
in class SpatialPrefixTree
dist
- >= 0public Node getNode(com.spatial4j.core.shape.Point p, int level)
getNode
in class SpatialPrefixTree
public Node getNode(String token)
SpatialPrefixTree
SpatialPrefixTree.getWorldNode()
.
Precondition: Never called when token length > maxLevel.getNode
in class SpatialPrefixTree
public Node getNode(byte[] bytes, int offset, int len)
getNode
in class SpatialPrefixTree
public List<Node> getNodes(com.spatial4j.core.shape.Shape shape, int detailLevel, boolean inclParents)
SpatialPrefixTree
Node.getSubCell(com.spatial4j.core.shape.Point)
. Cell subclasses
ideally implement that method with a quick implementation, otherwise, subclasses should
override this method to invoke SpatialPrefixTree.getNodesAltPoint(com.spatial4j.core.shape.Point, int, boolean)
.
TODO consider another approach returning an iterator -- won't build up all cells in memory.getNodes
in class SpatialPrefixTree
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.