Geospatial SQL
Query and index geometry data types such as points, lines, and polygons in GridGain 8 using spatial SQL, the ignite-geospatial library, and the GEOMETRY type.
In addition to the standard ANSI-99 SQL queries that are executed over primitive data types, or objects of custom types, GridGain also allows querying and indexing geometry data types such as points, lines, and polygons, while considering the spatial relationship between these geometries.
Spatial query capabilities, as well as available functions and operands, are defined by the Simple Features Specification for SQL. GridGain supports the intersection operation (&&) using the JTS Topology Suite.
Including Geospatial Library
The Geospatial library (ignite-geospatial) depends on JTS, which is available under the LGPL license. The latter is not aligned with the Apache license, which prevents inclusion of ignite-geospatial in the GridGain binary deliveries. This is why a binary version of the ignite-geospatial library is hosted in a separate Maven repository:
<repositories>
<repository>
<id>GridGain External Repository</id>
<url>https://www.gridgainsystems.com/nexus/content/repositories/external</url>
</repository>
</repositories>Add this repository and the Maven dependency below to your pom.xml file to include the geospatial library in your application:
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-geospatial</artifactId>
<version>${gridgain.version}</version>
</dependency>GEOMETRY
GEOMETRY is a spatial geometry type, based on the com.vividsolutions.jts library. It is usually represented in a textual format using WKT (well-known text).
GEOMETRY maps to:
Java/JDBC: data types from the
com.vividsolutions.jtspackage.NET/C#: N/A
C/C++: N/A
ODBC: N/A
Geospatial Queries
The geospatial module can be used only for the objects of the com.vividsolutions.jts type.
To configure indexes and/or queryable fields of geometric types, use the same approach you do for non-geospatial types. You can define indexes:
With the use of
org.apache.ignite.cache.QueryEntity, which is convenient for Spring XML-based configurationsBy annotating indexes with
@QuerySqlField, which will be converted toQueryEntitiesinternally
QuerySqlField
QueryEntity XML
QueryEntity Java
SQL
Examples
After the GEOMETRY-type fields are defined using one of the above methods, you can execute queries using values stored in these fields.
Example 1
Example 2
A Complete Example
A ready-to-run example of geospatial query usage can be found here.
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

