large left background img min
layer1

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

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

Further constructors are available via

  • GEO_POINT()
  • GEO_LINESTRING()
  • GEO_MULTILINESTRING()
  • GEO_POLYGON()
  • GEO_MULTIPOLYGON()
background img reverse min

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)

or sorting multiple documents by distance to a given point

ArangoDB can now also perform advanced calculations like GEO_CONTAINS()

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.

RestaurantsInNeighborhoodPNG

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!