Apache Ignite

GridGain Developer Hub - Apache Ignitetm

Welcome to the Apache Ignite developer hub run by GridGain. Here you'll find comprehensive guides and documentation to help you start working with Apache Ignite as quickly as possible, as well as support if you get stuck.


GridGain also provides Community Edition which is a distribution of Apache Ignite made available by GridGain. It is the fastest and easiest way to get started with Apache Ignite. The Community Edition is generally more stable than the Apache Ignite release available from the Apache Ignite website and may contain extra bug fixes and features that have not made it yet into the release on the Apache website.


Let's jump right in!


Documentation     Ask a Question     Download


Javadoc     Scaladoc     Examples

Geospatial Support

Working With Spatial Data Types


In addition to the standard ANSI-99 SQL queries that are supported by Ignite and executed over primitive data types or objects of specific/custom types, the platform also allows querying and indexing geometry data types such as points, lines, and polygons considering the spatial relationship between these geometries.

Spatial queries' capabilities, as well as available functions and operands, are defined by Simple Features Specification for SQL. The specification is fully implemented by JTS Topology Suite which is used by Apache Ignite along with H2 in order to build the unique geospatial component that works in a distributed and fault-tolerant fashion.

Including Ignite Geospatial Library

Ignite geospatial library (ignite-geospatial) depends on JTS that is available under the LGPL license that is not aligned with Apache license and prevents from including ignite-geospatial into Apache Ignite binary deliveries.

Due to this reason, a binary version of ignite-geospatial library is hosted in the Maven repository shown below:

    <id>GridGain External Repository</id>

Add this repository and the Maven dependency below to your pom.xml file to make sure that the geospatial library is included into your application:


Alternatively, you can download Apache Ignite from the source releases and built the library on your own.

Executing Geospatial Queries

The geospatial module is usable only for the objects of com.vividsolutions.jts type.

To configure indexes and/or queryable​ fields of geometric types, you need to use the same approached that is used for non-geospatial types. First, the indexes can be defined with the help of org.apache.ignite.cache.QueryEntity which is convenient for Spring XML based configurations. Second, you can achieve the same outcome by annotating indexes with @QuerySqlField annotations which will be converted QueryEntities internally.

 * Map point with indexed coordinates.
private static class MapPoint {
    /** Coordinates. */
    @QuerySqlField(index = true)
    private Geometry coords;

     * @param coords Coordinates.
    private MapPoint(Geometry coords) {
        this.coords = coords;
<bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name" value="mycache"/>
    <!-- Configure query entities -->
    <property name="queryEntities">
            <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Integer"/>
                <property name="valueType" value="org.apache.ignite.examples.MapPoint"/>

                <property name="fields">
                        <entry key="coords" value="com.vividsolutions.jts.geom.Geometry"/>

                <property name="indexes">
                        <bean class="org.apache.ignite.cache.QueryIndex">
                            <constructor-arg value="coords"/>

After the fields of geometry types are defined using on of the methods above, it's time to execute queries using the values stored in those fields.

// Query to find points that fit into a polygon.
SqlQuery<Integer, MapPoint> query = new SqlQuery<>(MapPoint.class, "coords && ?");

// Defining the polygon's boundaries.
query.setArgs("POLYGON((0 0, 0 99, 400 500, 300 0, 0 0))");

// Executing the query.
Collection<Cache.Entry<Integer, MapPoint>> entries = cache.query(query).getAll();

// Printing number of points that fit into the area defined by the polygon.
System.out.println("Fetched points [" + entries.size() + ']');

Complete Example

A ready-to-be-run example that demonstrates the usage of geospatial queries in Ignite can be found here.

Geospatial Support

Working With Spatial Data Types