Spatial queries with polygons require JTS

JTS (Java Topology Suite) is required to index polygon and multi-polygon shapes and perform queries using polygon shapes. Dynamic fields for spatial subfields use prefix naming conventions to enable map types to store geospatial data. DSE Search includes the Apache Solr™ Spatial4j library that adds advanced spatial types like polygons to search indexes.

Spatial field type with JTS enabled

For optimal indexing of multipolygon shapes, you must set useJtsMulti="false". For example:

<fieldType autoIndex="true" useJtsMulti="false"
          class="solr.SpatialRecursivePrefixTreeFieldType" distErrPct="0.0125"
          distanceUnits="kilometers" geo="true" name="WktField" spatialContextFactory="org.locationtech.
          spatial4j.context.jts.JtsSpatialContextFactory"/>

Advanced spatial queries using spatial predicates

DSE Search supports these spatial predicates:

  • Intersects

  • IsWithin

  • IsDisjointTo

  • Contains

Examples

Intersects

fq=geo:"Intersects(-74.093 41.042 -69.347 44.558)"

IsWithin

fq=geo:"IsWithin(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"

IsDisjointTo

fq=geo:"IsDisjointTo(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"

Contains

fq=geo:"Contains(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com