简体   繁体   中英

Unique Geo Index ArangoDB

I am new to ArangoDB. I am using it with geospatial data(geoJSON).

The database allows duplicate vertices for points with equal latitude and longitude, respectively. I assume, in order to eliminate duplicate vertices, I have to set the unique property of the geo index to true. I referred to the previous discussions on this issue, where it was suggested to change the constraint property, instead of the unique property(for version 1.3). I tried it both the ways. I changed the value of the property to true, for each of them and both of them, as well. I did this from arangosh using the "ensureIndex" method. The index created still shows false for unique.

I am using ArangoDB 3.0.4 and the documentation shows that the property unique is only supported for hash and skiplist indexes. Any suggestions on how I can go ahead and make vertices for only unique latitude&longitude?

There is no unique option since a long time. I think this can be explained like this:

If you want to prevent duplicate coordinates from being stored in your database, a simple unique option is probably insufficient, because the slightest deviation would make the coordinate unique again - just move it by 1 inch or cm in an arbitrary direction. That other coordinate should probably be treated like a duplicate as well, but the numbers are different. One would have to compute the distance to nearby vertices and see if it's less than a certain threshold to consider it as duplicate.

As the desired settings may vary for every project (including how to calculate the distance even), it should be managed on the application layer. You could write a Foxx service that you can talk to to store new coordinates. All the required calculations and database transactions can be done there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM