Indexing and querying polygons

Using United States of America state data, this tutorial demonstrates how to index and query geospatial shapes, such as Polygons and MultiPolygons.

Geospatial data is stored in the database in WKT (Well Known Text) format. To support Polygons and MultiPolygons fields, set the field type in the table index schema to solr.SpatialRecursivePrefixTreeFieldType.
Tip: SpatialRecursivePrefixTreeFieldType supports multiValued spatial data. Most states are describable as Polygons, but others such as Hawaii and Alaska are MultiPolygons.

Polygonal searches use the following geospatial predicates:

  • Intersects: Matches if the indexed value overlaps the search criteria.
  • IsWithin: Matches if the indexed value completely encapsulates the search criteria.
  • IsDisjointTo: Matches if the index value does not overlap or touch the search criteria.
https://github.com/payamp/dse-search-polygon-tutorial#step-1-load-jts-library

Procedure