# Lucene 8.1.0 spatial-extras API

The Spatial-Extras Module for Apache Lucene

See: Description

Packages
Package | Description
--- | ---
org.apache.lucene.spatial | Lucene advanced spatial search
org.apache.lucene.spatial.bbox | Bounding Box Spatial Strategy
org.apache.lucene.spatial.composite | Composite strategies.
org.apache.lucene.spatial.prefix | Prefix Tree Strategy.
org.apache.lucene.spatial.prefix.tree | This package is about SpatialPrefixTree and any supporting classes.
org.apache.lucene.spatial.query | Spatial Query options useful for client side requests
org.apache.lucene.spatial.serialized | Strategies that serialize the shape (non-indexed).
org.apache.lucene.spatial.spatial4j | Spatial4j stuff that ideally belongs in Spatial4j (isn't related to Lucene).
org.apache.lucene.spatial.util | Advanced spatial utilities.
org.apache.lucene.spatial.vector | Spatial strategy that uses two fields.

# The Spatial-Extras Module for Apache Lucene

The spatial-extras module, new to Lucene 6.5, is the new home for the original lucene spatial module. The principle interface to this module is a `SpatialStrategy` which encapsulates an approach to indexing and searching based on shapes. Different Strategies have different features and performance profiles, which are documented at each Strategy implementation class level.

For some sample code showing how to use the API, see SpatialExample.java in the tests.

The spatial-extras module uses Spatial4j heavily. Spatial4j is an ASL licensed library with these capabilities:

- Provides shape implementations, namely point, rectangle, and circle. Both geospatial contexts and plain 2D Euclidean/Cartesian contexts are supported. With an additional dependency, it adds polygon and other geometry shape support via integration with JTS Topology Suite. This includes dateline wrap support.
- Shape parsing and serialization, including Well-Known Text (WKT) (via JTS).
- Distance and other spatial related math calculations.

Historical note: The new spatial-extras module was once known as Lucene Spatial Playground (LSP) as an external project. In ~March 2012, LSP split into the spatial module as part of Lucene and Spatial4j externally. A large chunk of the LSP implementation originated as SOLR-2155 which uses trie/prefix-tree algorithms with a geohash encoding. That approach is implemented in `RecursivePrefixTreeStrategy` today.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.