tzaeschke / tinspin-indexes

Spatial index library with R*Tree, STR-Tree, Quadtree, CritBit, KD-Tree, CoverTree and PH-Tree
http://www.tinspin.org
Apache License 2.0
111 stars 24 forks source link
covertree crit-bit-trees index indexing java kd-tree multidimensional octree patricia ph-tree phtree quadtree quadtree-hc r-star-tree r-tree spatial spatial-data str-tree tinspin-indexes tree

Build Status codecov

TinSpin Indexes

This is a library of in-memory indexes. They are used in the TinSpin TinSpin project. The library includes:

TinSpin indexes are also available via maven:

<dependency>
    <groupId>org.tinspin</groupId>
    <artifactId>tinspin-indexes</artifactId>
    <version>2.1.4</version>
</dependency>

Overview

The indexes fall into four categories, depending on whether they use points or (axis-aligned) boxes as keys and whether they are maps or multimaps. This results in four base types with respective Java interfaces:

Indexes can be created via factories in the interfaces, e.g. PointMap.Factory.createKdTree(...).

WARNING The Map implementations are mostly not strict with respect to unique keys. That means they work fine if keys are unique. However, they may not enforce uniqueness (replace entries when the same key is added twice) and instead always add another entry. That means they may effectively act as multimaps. At the moment, only PH-Tree based indexes enforce uniqueness and properly overwrite existing keys.

Note:

Changelog

See CHANGELOG for details.

Performance

Some hints to improve performance:

CritBit

A Critical Bit tree for k-dimensional or arbitrary length keys. (Also called: binary patricia trie, radix-tree, ...)

Current version:

This is a Java implementation of a crit-bit tree. A crit-bit tree is a Patricia-Trie for binary data. Patricia-Tries achieve space efficiency by using prefix sharing. They are also update efficient because they are 'stable' trees, meaning that any update will affect at most two nodes.

Unlike other crit-bit trees, this tree also supports multi-dimensional data by interleaving the bits of each dimension and allowing k-dimensional queries on the tree.

Alternatively it supports 1-dimensional keys with arbitrary length (>64 bit).