home shape
GeoJSON support in ArangoDB 3.4

GeoJSON & Geospatial Queries in ArangoDB

Mobility planning, logistics optimizations, territory management or location-aware recommendation systems rely heavily on geospatial data. With the new GeoJSON support and ArangoDB’s native multi-model nature, development of these kind of applications got much simpler.

Since version 3.4, ArangoDB fully supports GeoJSON and a broad range of geospatial queries. To guarantee fast, precise and robust geospatial calculations, the Google S2 Geometry Library has been integrated on C++ level. All geo-primitives are supported.

Go through the GeoJSON tutorial to try it out.

Geospatial Query Capabilities

The GeoJSON representation of a Point in ArangoDB consist of longitude and latitude

    {"coordinates": [10.0, 20.0], "type": "Point" } // (10.0 = long; 20.0 = lat)

Based on this fundamental representation ArangoDB 3.4 supports the following geo primitives

  • Point & MultiPoint
  • LineString & MultiLineString
  • Polygons & MultiPolygons
right blob img min

Geo Constructors

To keep things simple, ArangoDB provides geo constructor functions directly in AQL. A simplified form for e.g. Germany would look like this

return GEO_POLYGON([
[6.591796875, 47.54687159892238], [14.5458984375, 47.635783590864854], [14.1943359375, 54.62297813269033], [6.50390625, 54.54657953

Further constructors are available via


Geo Functions

With ArangoDB 3.4 developers have much more possibilities and tools to work with geospatial data.

From simple DISTANCE () calculations between to arbitrary points (in meters)

// Distance from Brandenburg Gate (Berlin) to ArangoDB headquarters (Cologne)
DISTANCE(52.5163, 13.3777, 50.9322, 6.94) // 476918.89688380965 (~477km)

or sorting multiple documents by distance to a given point

// Sort a small number of documents based on distance to Central Park (New York)
FOR doc IN doc // e.g. documents returned by a traversal
SORT DISTANCE(doc.latitude, doc.longitude, 40.78, -73.97)

ArangoDB can now also perform advanced calculations like GEO_CONTAINS()

FOR n IN neighborhoods
FILTER n.name == "Chinatown" LET chinatown = n
FOR restaurant IN restaurants
FILTER GEO_CONTAINS(chinatown.geometry, restaurant.location) RETURN restaurant.location

Further Geo Functions encompass GEO_INTERSECTSGEO_DISTANCE() and GEO_EQUALS(). These new functions should enough flexibility for sophisticated, location-based applications.

OpenStreetMap Integration

A useful and pretty neat upgrade to ArangoDB WebUI is the direct integration of OpenStreetMap. ArangoDB automatically recognizes, that the result of a query is geospatial and visualizes the result accordingly in OpenStreetMap. Of course, users can easily switch to JSON or Table representation of their result sets.


Use Cases for Native Multi-Model Enriched with Location Data

Location-based application are already widespread. Our experience over the past years shows, that within these applications, multiple data models are being widely used. Native multi-model has a huge potential to simplify future development of these applications but also to enrich existing location-based projects with graph or search capabilities.

Let’s take a look at just a few examples:

In the upcoming age of self-driving cars, owners will expect a “self-managing” roadside assistance service with minimized effort on the driver side. If a car needs maintenance, it recognizes the problem (key/value or document model), finds the nearest maintenance team (geo query) which has the right skills & permission to perform the task (graph-based search) and sends a report directly to the maintenance team (JSON document). Building these services is perfectly suited to native multi-model.

People trust recommendations of people they know or who are very similar to them the most. More and more people travel around the globe. Building location-aware recommendation engines will play a key role in driving revenue and user satisfaction.

A growing number of law enforcement agencies want to predict crimes to prevent them. These agencies utilize data from different source (document), create context (graph) and leverage machine learning or even AI to predict where crimes might happen (geospatial) to prevent them from happening.

Enhanced Fraud Detection and Prevention applications in large insurance companies also make use of geospatial data to enrich their data models location information. Predictive analytics in claim analysis use the historic context of claim data (graph) to automatically and efficiently predict if a claim might be fraudulent or not. Flagged cases can then be send to specialized teams for further processing.

There are of course countless possible applications for native multi-model and geo data. We’d love to hear about your project!

right blob img min
background img
right blob img min
background img
right blob img min
background img
background img
right blob img min
background img
right blob img min
background img
right blob img min
background img