Geo Indexes
Introduction to Geo Indexes
This is an introduction to ArangoDB's geo indexes.
AQL's geographic features are described in Geo functions.
ArangoDB uses Hilbert curves to implement geo-spatial indexes. See this blog for details.
A geo-spatial index assumes that the latitude is between -90 and 90 degree and the longitude is between -180 and 180 degree. A geo index will ignore all documents which do not fulfill these requirements.
Currently, geo indexes are not yet supported with the RocksDB storage engine. Thus the functions NEAR()
, WITHIN()
and WITHIN_RECTANGLE()
will be unavailable when using this storage engine. To use geo indexes, please use the MMFiles storage engine for the time being.
Accessing Geo Indexes from the Shell
ensures that a geo index exists
collection.ensureIndex({ type: "geo", fields: [ "location" ] })
Creates a geo-spatial index on all documents using location as path to the coordinates. The value of the attribute has to be an array with at least two numeric values. The array must contain the latitude (first value) and the longitude (second value).
All documents, which do not have the attribute path or have a non-conforming value in it are excluded from the index.
A geo index is implicitly sparse, and there is no way to control its sparsity.
In case that the index was successfully created, an object with the index details, including the index-identifier, is returned.
To create a geo index on an array attribute that contains longitude first, set the
geoJson attribute to true
. This corresponds to the format described in
RFC 7946 Position
collection.ensureIndex({ type: "geo", fields: [ "location" ], geoJson: true })
To create a geo-spatial index on all documents using latitude and longitude as separate attribute paths, two paths need to be specified in the fields array:
collection.ensureIndex({ type: "geo", fields: [ "latitude", "longitude" ] })
In case that the index was successfully created, an object with the index details, including the index-identifier, is returned.
Examples
Create a geo index for an array attribute:
arangosh> db.geo.ensureIndex({ type: "geo", fields: [ "loc" ] });
{
"constraint" : false,
"fields" : [
"loc"
],
"geoJson" : false,
"id" : "geo/22345",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo1",
"unique" : false,
"code" : 201
}
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geo.save({ name : "Name/" + i + "/" + j, loc: [ i, j ] });
........> }
........> }
arangosh> db.geo.count();
703
arangosh> db.geo.near(0, 0).limit(3).toArray();
[
{
"_key" : "23402",
"_id" : "geo/23402",
"_rev" : "_VTxTbLy--C",
"name" : "Name/0/0",
"loc" : [
0,
0
]
},
{
"_key" : "23405",
"_id" : "geo/23405",
"_rev" : "_VTxTbL2---",
"name" : "Name/0/10",
"loc" : [
0,
10
]
},
{
"_key" : "23291",
"_id" : "geo/23291",
"_rev" : "_VTxTbLW--B",
"name" : "Name/-10/0",
"loc" : [
-10,
0
]
}
]
arangosh> db.geo.near(0, 0).count();
null
arangosh> db.geo.ensureIndex({ type: "geo", fields: [ "loc" ] });
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geo.save({ name : "Name/" + i + "/" + j, loc: [ i, j ] });
........> }
........> }
arangosh> db.geo.count();
arangosh> db.geo.near(0, 0).limit(3).toArray();
arangosh> db.geo.near(0, 0).count();
Create a geo index for a hash array attribute:
arangosh> db.geo2.ensureIndex({ type: "geo", fields: [ "location.latitude", "location.longitude" ] });
{
"constraint" : false,
"fields" : [
"location.latitude",
"location.longitude"
],
"id" : "geo2/24476",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo2",
"unique" : false,
"code" : 201
}
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geo2.save({ name : "Name/" + i + "/" + j, location: { latitude : i, longitude : j } });
........> }
........> }
arangosh> db.geo2.near(0, 0).limit(3).toArray();
[
{
"_key" : "25537",
"_id" : "geo2/25537",
"_rev" : "_VTxTbb2--B",
"name" : "Name/0/0",
"location" : {
"latitude" : 0,
"longitude" : 0
}
},
{
"_key" : "25540",
"_id" : "geo2/25540",
"_rev" : "_VTxTbb6---",
"name" : "Name/0/10",
"location" : {
"latitude" : 0,
"longitude" : 10
}
},
{
"_key" : "25426",
"_id" : "geo2/25426",
"_rev" : "_VTxTbbO---",
"name" : "Name/-10/0",
"location" : {
"latitude" : -10,
"longitude" : 0
}
}
]
arangosh> db.geo2.ensureIndex({ type: "geo", fields: [ "location.latitude", "location.longitude" ] });
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geo2.save({ name : "Name/" + i + "/" + j, location: { latitude : i, longitude : j } });
........> }
........> }
arangosh> db.geo2.near(0, 0).limit(3).toArray();
Use GeoIndex with AQL SORT statement:
arangosh> db.geoSort.ensureIndex({ type: "geo", fields: [ "latitude", "longitude" ] });
{
"constraint" : false,
"fields" : [
"latitude",
"longitude"
],
"id" : "geoSort/30847",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo2",
"unique" : false,
"code" : 201
}
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geoSort.save({ name : "Name/" + i + "/" + j, latitude : i, longitude : j });
........> }
........> }
arangosh> var query = "FOR doc in geoSort SORT DISTANCE(doc.latitude, doc.longitude, 0, 0) LIMIT 5 RETURN doc"
arangosh> db._explain(query, {}, {colors: false});
Query string:
FOR doc in geoSort SORT DISTANCE(doc.latitude, doc.longitude, 0, 0) LIMIT 5 RETURN doc
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT
7 IndexNode 703 - FOR doc IN geoSort /* geo2 index scan */
5 LimitNode 5 - LIMIT 0, 5
6 ReturnNode 5 - RETURN doc
Indexes used:
By Type Collection Unique Sparse Selectivity Fields Ranges
7 geo2 geoSort false true n/a [ `latitude`, `longitude` ] NEAR(doc, 0, 0)
Optimization rules applied:
Id RuleName
1 geo-index-optimizer
2 remove-unnecessary-calculations-2
arangosh> db._query(query);
[
{
"_key" : "31904",
"_id" : "geoSort/31904",
"_rev" : "_VTxTcHa--_",
"name" : "Name/0/0",
"latitude" : 0,
"longitude" : 0
},
{
"_key" : "31793",
"_id" : "geoSort/31793",
"_rev" : "_VTxTcG2--B",
"name" : "Name/-10/0",
"latitude" : -10,
"longitude" : 0
},
{
"_key" : "31907",
"_id" : "geoSort/31907",
"_rev" : "_VTxTcHa--A",
"name" : "Name/0/10",
"latitude" : 0,
"longitude" : 10
},
{
"_key" : "32015",
"_id" : "geoSort/32015",
"_rev" : "_VTxTcH6---",
"name" : "Name/10/0",
"latitude" : 10,
"longitude" : 0
},
{
"_key" : "31901",
"_id" : "geoSort/31901",
"_rev" : "_VTxTcHa---",
"name" : "Name/0/-10",
"latitude" : 0,
"longitude" : -10
}
]
[object ArangoQueryCursor, count: 5, cached: false, hasMore: false]
arangosh> db.geoSort.ensureIndex({ type: "geo", fields: [ "latitude", "longitude" ] });
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geoSort.save({ name : "Name/" + i + "/" + j, latitude : i, longitude : j });
........> }
........> }
arangosh> var query = "FOR doc in geoSort SORT DISTANCE(doc.latitude, doc.longitude, 0, 0) LIMIT 5 RETURN doc"
arangosh> db._explain(query, {}, {colors: false});
arangosh> db._query(query);
Use GeoIndex with AQL FILTER statement:
arangosh> db.geoFilter.ensureIndex({ type: "geo", fields: [ "latitude", "longitude" ] });
{
"constraint" : false,
"fields" : [
"latitude",
"longitude"
],
"id" : "geoFilter/26600",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo2",
"unique" : false,
"code" : 201
}
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geoFilter.save({ name : "Name/" + i + "/" + j, latitude : i, longitude : j });
........> }
........> }
arangosh> var query = "FOR doc in geoFilter FILTER DISTANCE(doc.latitude, doc.longitude, 0, 0) < 2000 RETURN doc"
arangosh> db._explain(query, {}, {colors: false});
Query string:
FOR doc in geoFilter FILTER DISTANCE(doc.latitude, doc.longitude, 0, 0) < 2000 RETURN doc
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT
6 IndexNode 703 - FOR doc IN geoFilter /* geo2 index scan */
5 ReturnNode 703 - RETURN doc
Indexes used:
By Type Collection Unique Sparse Selectivity Fields Ranges
6 geo2 geoFilter false true n/a [ `latitude`, `longitude` ] WITHIN(doc, 0, 0, 2000, false)
Optimization rules applied:
Id RuleName
1 geo-index-optimizer
2 remove-unnecessary-calculations-2
arangosh> db._query(query);
[
{
"_key" : "27657",
"_id" : "geoFilter/27657",
"_rev" : "_VTxTbqS--_",
"name" : "Name/0/0",
"latitude" : 0,
"longitude" : 0
}
]
[object ArangoQueryCursor, count: 1, cached: false, hasMore: false]
arangosh> db.geoFilter.ensureIndex({ type: "geo", fields: [ "latitude", "longitude" ] });
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.geoFilter.save({ name : "Name/" + i + "/" + j, latitude : i, longitude : j });
........> }
........> }
arangosh> var query = "FOR doc in geoFilter FILTER DISTANCE(doc.latitude, doc.longitude, 0, 0) < 2000 RETURN doc"
arangosh> db._explain(query, {}, {colors: false});
arangosh> db._query(query);
constructs a geo index selection
collection.geo(location-attribute)
Looks up a geo index defined on attribute location_attribute.
Returns a geo index object if an index was found. The near
or
within
operators can then be used to execute a geo-spatial query on
this particular index.
This is useful for collections with multiple defined geo indexes.
collection.geo(location_attribute, true)
Looks up a geo index on a compound attribute location_attribute.
Returns a geo index object if an index was found. The near
or
within
operators can then be used to execute a geo-spatial query on
this particular index.
collection.geo(latitude_attribute, longitude_attribute)
Looks up a geo index defined on the two attributes latitude_attribute
and longitude-attribute.
Returns a geo index object if an index was found. The near
or
within
operators can then be used to execute a geo-spatial query on
this particular index.
Note: this method is not yet supported by the RocksDB storage engine.
Note: the geo simple query helper function is deprecated as of ArangoDB
2.6. The function may be removed in future versions of ArangoDB. The preferred
way for running geo queries is to use their AQL equivalents.
Examples
Assume you have a location stored as list in the attribute home
and a destination stored in the attribute work. Then you can use the
geo
operator to select which geo-spatial attributes (and thus which
index) to use in a near
query.
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.complex.save({ name : "Name/" + i + "/" + j,
........> home : [ i, j ],
........> work : [ -i, -j ] });
........> }
........> }
........>
arangosh> db.complex.near(0, 170).limit(5);
[ArangoError 1570: no suitable geo index found for geo restriction on 'complex']
arangosh> db.complex.ensureIndex({ type: "geo", fields: [ "home" ] });
{
"constraint" : false,
"fields" : [
"home"
],
"geoJson" : false,
"id" : "complex/30829",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo1",
"unique" : false,
"code" : 201
}
arangosh> db.complex.near(0, 170).limit(5).toArray();
[
{
"_key" : "29823",
"_id" : "complex/29823",
"_rev" : "_VTxTb2y--B",
"name" : "Name/0/170",
"home" : [
0,
170
],
"work" : [
0,
-170
]
},
{
"_key" : "29826",
"_id" : "complex/29826",
"_rev" : "_VTxTb2y--C",
"name" : "Name/0/180",
"home" : [
0,
180
],
"work" : [
0,
-180
]
},
{
"_key" : "29718",
"_id" : "complex/29718",
"_rev" : "_VTxTb2O--A",
"name" : "Name/0/-180",
"home" : [
0,
-180
],
"work" : [
0,
180
]
},
{
"_key" : "29934",
"_id" : "complex/29934",
"_rev" : "_VTxTb3O--A",
"name" : "Name/10/170",
"home" : [
10,
170
],
"work" : [
-10,
-170
]
},
{
"_key" : "29712",
"_id" : "complex/29712",
"_rev" : "_VTxTb2O---",
"name" : "Name/-10/170",
"home" : [
-10,
170
],
"work" : [
10,
-170
]
}
]
arangosh> db.complex.geo("work").near(0, 170).limit(5);
[ArangoError 1570: no suitable geo index found for geo restriction on 'complex']
arangosh> db.complex.ensureIndex({ type: "geo", fields: [ "work" ] });
{
"constraint" : false,
"fields" : [
"work"
],
"geoJson" : false,
"id" : "complex/30837",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo1",
"unique" : false,
"code" : 201
}
arangosh> db.complex.geo("work").near(0, 170).limit(5).toArray();
[
{
"_key" : "29823",
"_id" : "complex/29823",
"_rev" : "_VTxTb2y--B",
"name" : "Name/0/170",
"home" : [
0,
170
],
"work" : [
0,
-170
]
},
{
"_key" : "29826",
"_id" : "complex/29826",
"_rev" : "_VTxTb2y--C",
"name" : "Name/0/180",
"home" : [
0,
180
],
"work" : [
0,
-180
]
},
{
"_key" : "29718",
"_id" : "complex/29718",
"_rev" : "_VTxTb2O--A",
"name" : "Name/0/-180",
"home" : [
0,
-180
],
"work" : [
0,
180
]
},
{
"_key" : "29934",
"_id" : "complex/29934",
"_rev" : "_VTxTb3O--A",
"name" : "Name/10/170",
"home" : [
10,
170
],
"work" : [
-10,
-170
]
},
{
"_key" : "29712",
"_id" : "complex/29712",
"_rev" : "_VTxTb2O---",
"name" : "Name/-10/170",
"home" : [
-10,
170
],
"work" : [
10,
-170
]
}
]
arangosh> for (i = -90; i <= 90; i += 10) {
........> for (j = -180; j <= 180; j += 10) {
........> db.complex.save({ name : "Name/" + i + "/" + j,
........> home : [ i, j ],
........> work : [ -i, -j ] });
........> }
........> }
........>
arangosh> db.complex.near(0, 170).limit(5);
arangosh> db.complex.ensureIndex({ type: "geo", fields: [ "home" ] });
arangosh> db.complex.near(0, 170).limit(5).toArray();
arangosh> db.complex.geo("work").near(0, 170).limit(5);
arangosh> db.complex.ensureIndex({ type: "geo", fields: [ "work" ] });
arangosh> db.complex.geo("work").near(0, 170).limit(5).toArray();
constructs a near query for a collection
collection.near(latitude, longitude)
The returned list is sorted according to the distance, with the nearest
document to the coordinate (latitude, longitude) coming first.
If there are near documents of equal distance, documents are chosen randomly
from this set until the limit is reached. It is possible to change the limit
using the limit operator.
In order to use the near operator, a geo index must be defined for the
collection. This index also defines which attribute holds the coordinates
for the document. If you have more then one geo-spatial index, you can use
the geo operator to select a particular index.
Note: near
does not support negative skips.
// However, you can still use limit
followed to skip.
collection.near(latitude, longitude).limit(limit)
Limits the result to limit documents instead of the default 100.
Note: Unlike with multiple explicit limits, limit
will raise
the implicit default limit imposed by within
.
collection.near(latitude, longitude).distance()
This will add an attribute distance
to all documents returned, which
contains the distance between the given point and the document in meters.
collection.near(latitude, longitude).distance(name)
This will add an attribute name to all documents returned, which
contains the distance between the given point and the document in meters.
Note: this method is not yet supported by the RocksDB storage engine.
Note: the near simple query function is deprecated as of ArangoDB 2.6.
The function may be removed in future versions of ArangoDB. The preferred
way for retrieving documents from a collection using the near operator is
to use the AQL NEAR function in an AQL query as follows:
FOR doc IN NEAR(@@collection, @latitude, @longitude, @limit)
RETURN doc
Examples
To get the nearest two locations:
arangosh> db.geo.ensureIndex({ type: "geo", fields: [ "loc" ] });
{
"constraint" : false,
"fields" : [
"loc"
],
"geoJson" : false,
"id" : "geo/205",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo1",
"unique" : false,
"code" : 201
}
arangosh> for (var i = -90; i <= 90; i += 10) {
........> for (var j = -180; j <= 180; j += 10) {
........> db.geo.save({
........> name : "Name/" + i + "/" + j,
........> loc: [ i, j ] });
........> } }
arangosh> db.geo.near(0, 0).limit(2).toArray();
[
{
"_key" : "1262",
"_id" : "geo/1262",
"_rev" : "_VTxSbA6--A",
"name" : "Name/0/0",
"loc" : [
0,
0
]
},
{
"_key" : "1151",
"_id" : "geo/1151",
"_rev" : "_VTxSbAS--B",
"name" : "Name/-10/0",
"loc" : [
-10,
0
]
}
]
arangosh> db.geo.ensureIndex({ type: "geo", fields: [ "loc" ] });
arangosh> for (var i = -90; i <= 90; i += 10) {
........> for (var j = -180; j <= 180; j += 10) {
........> db.geo.save({
........> name : "Name/" + i + "/" + j,
........> loc: [ i, j ] });
........> } }
arangosh> db.geo.near(0, 0).limit(2).toArray();
If you need the distance as well, then you can use the distance
operator:
arangosh> db.geo.ensureIndex({ type: "geo", fields: [ "loc" ] });
{
"constraint" : false,
"fields" : [
"loc"
],
"geoJson" : false,
"id" : "geo/2325",
"ignoreNull" : true,
"isNewlyCreated" : true,
"sparse" : true,
"type" : "geo1",
"unique" : false,
"code" : 201
}
arangosh> for (var i = -90; i <= 90; i += 10) {
........> for (var j = -180; j <= 180; j += 10) {
........> db.geo.save({
........> name : "Name/" + i + "/" + j,
........> loc: [ i, j ] });
........> } }
arangosh> db.geo.near(0, 0).distance().limit(2).toArray();
[
{
"distance" : 0,
"_id" : "geo/3382",
"_key" : "3382",
"_rev" : "_VTxSbOi--C",
"loc" : [
0,
0
],
"name" : "Name/0/0"
},
{
"distance" : 1111949.2664455874,
"_id" : "geo/3271",
"_key" : "3271",
"_rev" : "_VTxSbOG--A",
"loc" : [
-10,
0
],
"name" : "Name/-10/0"
}
]
arangosh> db.geo.ensureIndex({ type: "geo", fields: [ "loc" ] });
arangosh> for (var i = -90; i <= 90; i += 10) {
........> for (var j = -180; j <= 180; j += 10) {
........> db.geo.save({
........> name : "Name/" + i + "/" + j,
........> loc: [ i, j ] });
........> } }
arangosh> db.geo.near(0, 0).distance().limit(2).toArray();
constructs a within query for a collection
collection.within(latitude, longitude, radius)
This will find all documents within a given radius around the coordinate
(latitude, longitude). The returned array is sorted by distance,
beginning with the nearest document.
In order to use the within operator, a geo index must be defined for the
collection. This index also defines which attribute holds the coordinates
for the document. If you have more then one geo-spatial index, you can use
the geo
operator to select a particular index.
collection.within(latitude, longitude, radius).distance()
This will add an attribute _distance
to all documents returned, which
contains the distance between the given point and the document in meters.
collection.within(latitude, longitude, radius).distance(name)
This will add an attribute name to all documents returned, which
contains the distance between the given point and the document in meters.
Note: this method is not yet supported by the RocksDB storage engine.
Note: the within simple query function is deprecated as of ArangoDB 2.6.
The function may be removed in future versions of ArangoDB. The preferred
way for retrieving documents from a collection using the within operator is
to use the AQL WITHIN function in an AQL query as follows:
FOR doc IN WITHIN(@@collection, @latitude, @longitude, @radius, @distanceAttributeName)
RETURN doc
Examples
To find all documents within a radius of 2000 km use:
arangosh> for (var i = -90; i <= 90; i += 10) {
........> for (var j = -180; j <= 180; j += 10) {
........> db.geo.save({ name : "Name/" + i + "/" + j, loc: [ i, j ] }); } }
arangosh> db.geo.within(0, 0, 2000 * 1000).distance().toArray();
[
{
"distance" : 0,
"_id" : "geo/5502",
"_key" : "5502",
"_rev" : "_VTxSbbi--D",
"loc" : [
0,
0
],
"name" : "Name/0/0"
},
{
"distance" : 1111949.2664455874,
"_id" : "geo/5499",
"_key" : "5499",
"_rev" : "_VTxSbbi--C",
"loc" : [
0,
-10
],
"name" : "Name/0/-10"
},
{
"distance" : 1111949.2664455874,
"_id" : "geo/5391",
"_key" : "5391",
"_rev" : "_VTxSbbG--B",
"loc" : [
-10,
0
],
"name" : "Name/-10/0"
},
{
"distance" : 1111949.2664455874,
"_id" : "geo/5505",
"_key" : "5505",
"_rev" : "_VTxSbbm---",
"loc" : [
0,
10
],
"name" : "Name/0/10"
},
{
"distance" : 1111949.2664455874,
"_id" : "geo/5613",
"_key" : "5613",
"_rev" : "_VTxSbc---D",
"loc" : [
10,
0
],
"name" : "Name/10/0"
},
{
"distance" : 1568520.5567985761,
"_id" : "geo/5616",
"_key" : "5616",
"_rev" : "_VTxSbcC---",
"loc" : [
10,
10
],
"name" : "Name/10/10"
},
{
"distance" : 1568520.5567985761,
"_id" : "geo/5388",
"_key" : "5388",
"_rev" : "_VTxSbbG--A",
"loc" : [
-10,
-10
],
"name" : "Name/-10/-10"
},
{
"distance" : 1568520.5567985761,
"_id" : "geo/5394",
"_key" : "5394",
"_rev" : "_VTxSbbK---",
"loc" : [
-10,
10
],
"name" : "Name/-10/10"
},
{
"distance" : 1568520.5567985761,
"_id" : "geo/5610",
"_key" : "5610",
"_rev" : "_VTxSbc---C",
"loc" : [
10,
-10
],
"name" : "Name/10/-10"
}
]
arangosh> for (var i = -90; i <= 90; i += 10) {
........> for (var j = -180; j <= 180; j += 10) {
........> db.geo.save({ name : "Name/" + i + "/" + j, loc: [ i, j ] }); } }
arangosh> db.geo.within(0, 0, 2000 * 1000).distance().toArray();
ensures that a geo index exists
collection.ensureIndex({ type: "geo", fields: [ "location" ] })
Since ArangoDB 2.5, this method is an alias for ensureGeoIndex since geo indexes are always sparse, meaning that documents that do not contain the index attributes or have non-numeric values in the index attributes will not be indexed. ensureGeoConstraint is deprecated and ensureGeoIndex should be used instead.
The index does not provide a unique
option because of its limited usability.
It would prevent identical coordinates from being inserted only, but even a
slightly different location (like 1 inch or 1 cm off) would be unique again and
not considered a duplicate, although it probably should. The desired threshold
for detecting duplicates may vary for every project (including how to calculate
the distance even) and needs to be implemented on the application layer as needed.
You can write a Foxx service for this purpose and make use
of the AQL geo functions to find nearby
coordinates supported by a geo index.