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 blogfor details.
A geo-spatial index assumes that the latitude is between -90 and 90 degree andthe longitude is between -180 and 180 degree. A geo index will ignore alldocuments which do not fulfill these requirements.
Accessing Geo Indexes from the Shell
ensures that a geo index existscollection.ensureIndex({ type: "geo", fields: [ "location" ] })
Creates a geo-spatial index on all documents using location as path tothe coordinates. The value of the attribute has to be an array with at least twonumeric values. The array must contain the latitude (first value) and thelongitude (second value).
All documents, which do not have the attribute path or have a non-conformingvalue 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 indexdetails, including the index-identifier, is returned.
To create a geo index on an array attribute that contains longitude first, set thegeoJson attribute to true
. This corresponds to the format described inRFC 7946 Position
collection.ensureIndex({ type: "geo", fields: [ "location" ], geoJson: true })
To create a geo-spatial index on all documents using latitude andlongitude as separate attribute paths, two paths need to be specifiedin the fields array:
collection.ensureIndex({ type: "geo", fields: [ "latitude", "longitude" ] })
In case that the index was successfully created, an object with the indexdetails, including the index-identifier, is returned.
Examples
Create a geo index for an array attribute:
- 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();
Show execution results
- {
- "constraint" : false,
- "fields" : [
- "loc"
- ],
- "geoJson" : false,
- "id" : "geo/24791",
- "ignoreNull" : true,
- "isNewlyCreated" : true,
- "sparse" : true,
- "type" : "geo1",
- "unique" : false,
- "code" : 201
- }
- 703
- [
- {
- "_key" : "25848",
- "_id" : "geo/25848",
- "_rev" : "_ZHpY3mC--_",
- "name" : "Name/0/0",
- "loc" : [
- 0,
- 0
- ]
- },
- {
- "_key" : "25851",
- "_id" : "geo/25851",
- "_rev" : "_ZHpY3mC--B",
- "name" : "Name/0/10",
- "loc" : [
- 0,
- 10
- ]
- },
- {
- "_key" : "25737",
- "_id" : "geo/25737",
- "_rev" : "_ZHpY3la--B",
- "name" : "Name/-10/0",
- "loc" : [
- -10,
- 0
- ]
- }
- ]
- null
Hide execution results
Create a geo index for a hash array attribute:
- 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();
Show execution results
- {
- "constraint" : false,
- "fields" : [
- "location.latitude",
- "location.longitude"
- ],
- "id" : "geo2/26918",
- "ignoreNull" : true,
- "isNewlyCreated" : true,
- "sparse" : true,
- "type" : "geo2",
- "unique" : false,
- "code" : 201
- }
- [
- {
- "_key" : "27975",
- "_id" : "geo2/27975",
- "_rev" : "_ZHpY30C--F",
- "name" : "Name/0/0",
- "location" : {
- "latitude" : 0,
- "longitude" : 0
- }
- },
- {
- "_key" : "27978",
- "_id" : "geo2/27978",
- "_rev" : "_ZHpY30G--_",
- "name" : "Name/0/10",
- "location" : {
- "latitude" : 0,
- "longitude" : 10
- }
- },
- {
- "_key" : "27864",
- "_id" : "geo2/27864",
- "_rev" : "_ZHpY3za--D",
- "name" : "Name/-10/0",
- "location" : {
- "latitude" : -10,
- "longitude" : 0
- }
- }
- ]
Hide execution results
Use GeoIndex with AQL SORT statement:
- 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);
Show execution results
- {
- "constraint" : false,
- "fields" : [
- "latitude",
- "longitude"
- ],
- "id" : "geoSort/33288",
- "ignoreNull" : true,
- "isNewlyCreated" : true,
- "sparse" : true,
- "type" : "geo2",
- "unique" : false,
- "code" : 201
- }
- 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
- [
- {
- "_key" : "34345",
- "_id" : "geoSort/34345",
- "_rev" : "_ZHpY4n---H",
- "name" : "Name/0/0",
- "latitude" : 0,
- "longitude" : 0
- },
- {
- "_key" : "34234",
- "_id" : "geoSort/34234",
- "_rev" : "_ZHpY4mW--G",
- "name" : "Name/-10/0",
- "latitude" : -10,
- "longitude" : 0
- },
- {
- "_key" : "34342",
- "_id" : "geoSort/34342",
- "_rev" : "_ZHpY4n---F",
- "name" : "Name/0/-10",
- "latitude" : 0,
- "longitude" : -10
- },
- {
- "_key" : "34348",
- "_id" : "geoSort/34348",
- "_rev" : "_ZHpY4nC--_",
- "name" : "Name/0/10",
- "latitude" : 0,
- "longitude" : 10
- },
- {
- "_key" : "34456",
- "_id" : "geoSort/34456",
- "_rev" : "_ZHpY4nm--D",
- "name" : "Name/10/0",
- "latitude" : 10,
- "longitude" : 0
- }
- ]
- [object ArangoQueryCursor, count: 5, cached: false, hasMore: false]
Hide execution results
Use GeoIndex with AQL FILTER statement:
- 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);
Show execution results
- {
- "constraint" : false,
- "fields" : [
- "latitude",
- "longitude"
- ],
- "id" : "geoFilter/29039",
- "ignoreNull" : true,
- "isNewlyCreated" : true,
- "sparse" : true,
- "type" : "geo2",
- "unique" : false,
- "code" : 201
- }
- 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
- [
- {
- "_key" : "30096",
- "_id" : "geoFilter/30096",
- "_rev" : "_ZHpY4Cq--B",
- "name" : "Name/0/0",
- "latitude" : 0,
- "longitude" : 0
- }
- ]
- [object ArangoQueryCursor, count: 1, cached: false, hasMore: false]
Hide execution results
constructs a geo index selectioncollection.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
orwithin
operators can then be used to execute a geo-spatial query onthis 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
orwithin
operators can then be used to execute a geo-spatial query onthis 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
orwithin
operators can then be used to execute a geo-spatial query onthis 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 ArangoDB2.6. The function may be removed in future versions of ArangoDB. The preferredway 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 thegeo
operator to select which geo-spatial attributes (and thus whichindex) 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/33269",
- "ignoreNull" : true,
- "isNewlyCreated" : true,
- "sparse" : true,
- "type" : "geo1",
- "unique" : false,
- "code" : 201
- }
- arangosh> db.complex.near(0, 170).limit(5).toArray();
- [
- {
- "_key" : "32263",
- "_id" : "complex/32263",
- "_rev" : "_ZHpY4VO--H",
- "name" : "Name/0/170",
- "home" : [
- 0,
- 170
- ],
- "work" : [
- 0,
- -170
- ]
- },
- {
- "_key" : "32266",
- "_id" : "complex/32266",
- "_rev" : "_ZHpY4VS--_",
- "name" : "Name/0/180",
- "home" : [
- 0,
- 180
- ],
- "work" : [
- 0,
- -180
- ]
- },
- {
- "_key" : "32152",
- "_id" : "complex/32152",
- "_rev" : "_ZHpY4Uu--_",
- "name" : "Name/-10/170",
- "home" : [
- -10,
- 170
- ],
- "work" : [
- 10,
- -170
- ]
- },
- {
- "_key" : "32374",
- "_id" : "complex/32374",
- "_rev" : "_ZHpY4V2--_",
- "name" : "Name/10/170",
- "home" : [
- 10,
- 170
- ],
- "work" : [
- -10,
- -170
- ]
- },
- {
- "_key" : "32158",
- "_id" : "complex/32158",
- "_rev" : "_ZHpY4Uu--D",
- "name" : "Name/0/-180",
- "home" : [
- 0,
- -180
- ],
- "work" : [
- 0,
- 180
- ]
- }
- ]
- 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/33277",
- "ignoreNull" : true,
- "isNewlyCreated" : true,
- "sparse" : true,
- "type" : "geo1",
- "unique" : false,
- "code" : 201
- }
- arangosh> db.complex.geo("work").near(0, 170).limit(5).toArray();
- [
- {
- "_key" : "32263",
- "_id" : "complex/32263",
- "_rev" : "_ZHpY4VO--H",
- "name" : "Name/0/170",
- "home" : [
- 0,
- 170
- ],
- "work" : [
- 0,
- -170
- ]
- },
- {
- "_key" : "32266",
- "_id" : "complex/32266",
- "_rev" : "_ZHpY4VS--_",
- "name" : "Name/0/180",
- "home" : [
- 0,
- 180
- ],
- "work" : [
- 0,
- -180
- ]
- },
- {
- "_key" : "32152",
- "_id" : "complex/32152",
- "_rev" : "_ZHpY4Uu--_",
- "name" : "Name/-10/170",
- "home" : [
- -10,
- 170
- ],
- "work" : [
- 10,
- -170
- ]
- },
- {
- "_key" : "32374",
- "_id" : "complex/32374",
- "_rev" : "_ZHpY4V2--_",
- "name" : "Name/10/170",
- "home" : [
- 10,
- 170
- ],
- "work" : [
- -10,
- -170
- ]
- },
- {
- "_key" : "32158",
- "_id" : "complex/32158",
- "_rev" : "_ZHpY4Uu--D",
- "name" : "Name/0/-180",
- "home" : [
- 0,
- -180
- ],
- "work" : [
- 0,
- 180
- ]
- }
- ]
Hide execution results
- 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();
Show execution results
constructs a near query for a collectioncollection.near(latitude, longitude)
The returned list is sorted according to the distance, with the nearestdocument to the coordinate (latitude, longitude) coming first.If there are near documents of equal distance, documents are chosen randomlyfrom this set until the limit is reached. It is possible to change the limitusing the limit operator.
In order to use the near operator, a geo index must be defined for thecollection. This index also defines which attribute holds the coordinatesfor the document. If you have more then one geo-spatial index, you can usethe 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 raisethe implicit default limit imposed by within
.
collection.near(latitude, longitude).distance()
This will add an attribute distance
to all documents returned, whichcontains 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, whichcontains 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 preferredway for retrieving documents from a collection using the near operator isto 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/219",
- "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" : "1276",
- "_id" : "geo/1276",
- "_rev" : "_ZHpYUQG--D",
- "name" : "Name/0/0",
- "loc" : [
- 0,
- 0
- ]
- },
- {
- "_key" : "1165",
- "_id" : "geo/1165",
- "_rev" : "_ZHpYUPe--F",
- "name" : "Name/-10/0",
- "loc" : [
- -10,
- 0
- ]
- }
- ]
Hide execution results
- 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();
Show execution results
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/2340",
- "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/3397",
- "_key" : "3397",
- "_rev" : "_ZHpYUei--_",
- "loc" : [
- 0,
- 0
- ],
- "name" : "Name/0/0"
- },
- {
- "distance" : 1111949.2664455874,
- "_id" : "geo/3286",
- "_key" : "3286",
- "_rev" : "_ZHpYUeC--J",
- "loc" : [
- -10,
- 0
- ],
- "name" : "Name/-10/0"
- }
- ]
Hide execution results
- 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();
Show execution results
constructs a within query for a collectioncollection.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 thecollection. This index also defines which attribute holds the coordinatesfor the document. If you have more then one geo-spatial index, you can usethe geo
operator to select a particular index.
collection.within(latitude, longitude, radius).distance()
This will add an attribute _distance
to all documents returned, whichcontains 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, whichcontains 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 preferredway for retrieving documents from a collection using the within operator isto 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/5518",
- "_key" : "5518",
- "_rev" : "_ZHpYUre--H",
- "loc" : [
- 0,
- 0
- ],
- "name" : "Name/0/0"
- },
- {
- "distance" : 1111949.2664455874,
- "_id" : "geo/5407",
- "_key" : "5407",
- "_rev" : "_ZHpYUr---D",
- "loc" : [
- -10,
- 0
- ],
- "name" : "Name/-10/0"
- },
- {
- "distance" : 1111949.2664455874,
- "_id" : "geo/5521",
- "_key" : "5521",
- "_rev" : "_ZHpYUri--_",
- "loc" : [
- 0,
- 10
- ],
- "name" : "Name/0/10"
- },
- {
- "distance" : 1111949.2664455874,
- "_id" : "geo/5629",
- "_key" : "5629",
- "_rev" : "_ZHpYUsC--F",
- "loc" : [
- 10,
- 0
- ],
- "name" : "Name/10/0"
- },
- {
- "distance" : 1111949.2664455874,
- "_id" : "geo/5515",
- "_key" : "5515",
- "_rev" : "_ZHpYUre--F",
- "loc" : [
- 0,
- -10
- ],
- "name" : "Name/0/-10"
- },
- {
- "distance" : 1568520.556798576,
- "_id" : "geo/5410",
- "_key" : "5410",
- "_rev" : "_ZHpYUr---F",
- "loc" : [
- -10,
- 10
- ],
- "name" : "Name/-10/10"
- },
- {
- "distance" : 1568520.556798576,
- "_id" : "geo/5632",
- "_key" : "5632",
- "_rev" : "_ZHpYUsC--H",
- "loc" : [
- 10,
- 10
- ],
- "name" : "Name/10/10"
- },
- {
- "distance" : 1568520.556798576,
- "_id" : "geo/5404",
- "_key" : "5404",
- "_rev" : "_ZHpYUr---B",
- "loc" : [
- -10,
- -10
- ],
- "name" : "Name/-10/-10"
- },
- {
- "distance" : 1568520.556798576,
- "_id" : "geo/5626",
- "_key" : "5626",
- "_rev" : "_ZHpYUsC--D",
- "loc" : [
- 10,
- -10
- ],
- "name" : "Name/10/-10"
- }
- ]
Hide execution results
- 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();
Show execution results
ensures that a geo index existscollection.ensureIndex({ type: "geo", fields: [ "location" ] })
Since ArangoDB 2.5, this method is an alias for ensureGeoIndex sincegeo indexes are always sparse, meaning that documents that do not containthe index attributes or have non-numeric values in the index attributeswill 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 aslightly different location (like 1 inch or 1 cm off) would be unique again andnot considered a duplicate, although it probably should. The desired thresholdfor detecting duplicates may vary for every project (including how to calculatethe distance even) and needs to be implemented on the application layer as needed.You can write a Foxx service for this purpose and make useof the AQL geo functions to find nearbycoordinates supported by a geo index.