public class LocationIndexTree extends Object implements LocationIndex
SpatialKeyAlgo
and can the use the resulting raw bits as cell index to recurse
into the subtrees. E.g. if there are 3 layers with 16, 4 and 4 cells each, then the reverse spatial key has
three parts: 4 bits for the cellIndex into the 16 cells, 2 bits for the next layer and 2 bits for the last layer.
It is the reverse spatial key and not the forward spatial key as we need the start of the index for the current
layer at index 0Modifier and Type | Class and Description |
---|---|
protected class |
LocationIndexTree.XFirstSearchCheck
Make it possible to collect nearby location also for other purposes.
|
LocationIndex.EdgeVisitor, LocationIndex.Visitor
Modifier and Type | Field and Description |
---|---|
protected DistanceCalc |
distCalc |
protected Graph |
graph |
protected SpatialKeyAlgo |
keyAlgo |
Constructor and Description |
---|
LocationIndexTree(Graph g,
Directory dir) |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method makes sure that the underlying used resources are released.
|
LocationIndexTree |
create(long size)
Creates the underlying storage.
|
QueryResult |
findClosest(double queryLat,
double queryLon,
EdgeFilter edgeFilter)
This method returns the closest QueryResult for the specified location (lat, lon) and only if
the filter accepts the edge as valid candidate (e.g.
|
List<QueryResult> |
findNClosest(double queryLat,
double queryLon,
EdgeFilter edgeFilter,
double radius)
Returns all edges that are within the specified radius around the queried position.
|
void |
flush()
This method makes sure that the underlying data is written to the storage.
|
long |
getCapacity() |
double |
getDeltaLat()
Provide info about tilesize for testing / visualization
|
double |
getDeltaLon() |
int |
getMinResolutionInMeter() |
boolean |
isClosed() |
boolean |
loadExisting() |
LocationIndex |
prepareIndex()
Creates this index - to be called once before findID.
|
void |
query(BBox queryShape,
LocationIndex.Visitor function)
This method explores the nodes in this LocationIndex with the specified Visitor.
|
LocationIndex |
setApproximation(boolean approx) |
LocationIndexTree |
setMaxRegionSearch(int numTiles)
Searches also neighbouring tiles until the maximum distance from the query point is reached
(minResolutionInMeter*regionAround).
|
LocationIndexTree |
setMinResolutionInMeter(int minResolutionInMeter)
Minimum width in meter of one tile.
|
LocationIndex |
setResolution(int minResolutionInMeter)
Integer value to specify the resolution of this location index.
|
void |
setSegmentSize(int bytes) |
protected final Graph graph
protected DistanceCalc distCalc
protected SpatialKeyAlgo keyAlgo
public int getMinResolutionInMeter()
public LocationIndexTree setMinResolutionInMeter(int minResolutionInMeter)
public LocationIndexTree setMaxRegionSearch(int numTiles)
public LocationIndex setResolution(int minResolutionInMeter)
LocationIndex
setResolution
in interface LocationIndex
public LocationIndex setApproximation(boolean approx)
setApproximation
in interface LocationIndex
approx
- false if initialization and querying should be faster but less precise.public LocationIndexTree create(long size)
Storable
create
in interface Storable<LocationIndex>
public boolean loadExisting()
loadExisting
in interface Storable<LocationIndex>
public void flush()
Storable
flush
in interface Storable<LocationIndex>
public LocationIndex prepareIndex()
LocationIndex
prepareIndex
in interface LocationIndex
public void close()
Storable
close
in interface Storable<LocationIndex>
close
in interface Closeable
close
in interface AutoCloseable
public boolean isClosed()
isClosed
in interface Storable<LocationIndex>
public long getCapacity()
getCapacity
in interface Storable<LocationIndex>
public void setSegmentSize(int bytes)
setSegmentSize
in interface LocationIndex
public double getDeltaLat()
public double getDeltaLon()
public void query(BBox queryShape, LocationIndex.Visitor function)
LocationIndex
query
in interface LocationIndex
public QueryResult findClosest(double queryLat, double queryLon, EdgeFilter edgeFilter)
LocationIndex
findClosest
in interface LocationIndex
edgeFilter
- if a graph supports multiple vehicles we have to make sure that the entry
node into the graph is accessible from a selected vehicle. E.g. if you have a FOOT-query do:
DefaultEdgeFilter.allEdges(footFlagEncoder);
public List<QueryResult> findNClosest(double queryLat, double queryLon, EdgeFilter edgeFilter, double radius)
TODO: either clarify the method name and description (to only search e.g. 9 tiles) or refactor so it can handle a radius larger than 9 tiles. Also remove reference to 'NClosest', which is misleading, and don't always return at least one value. See map-matching #65. TODO: tidy up logic - see comments in graphhopper #994.
radius
- in metersCopyright © 2012–2019. All rights reserved.