简体   繁体   English

独特的地理索引ArangoDB

[英]Unique Geo Index ArangoDB

I am new to ArangoDB. 我是ArangoDB的新手。 I am using it with geospatial data(geoJSON). 我正在将其与地理空间数据(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. 我假设,为了消除重复的顶点,我必须将geo索引的unique属性设置为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). 我参考了之前关于此问题的讨论,建议更改约束属性,而不是唯一属性(对于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. 对于每个属性以及两个属性,我都将属性的值更改为true。 I did this from arangosh using the "ensureIndex" method. 我使用“ ensureIndex”方法从arangosh做到了这一点。 The index created still shows false for unique. 创建的索引仍然显示false(表示唯一)。

I am using ArangoDB 3.0.4 and the documentation shows that the property unique is only supported for hash and skiplist indexes. 我正在使用ArangoDB 3.0.4,该文档显示仅哈希和跳过列表索引支持唯一属性。 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. 如果要防止将重复的坐标存储在数据库中,则简单的唯一选项可能不足,因为最小的偏差会使坐标再次变得唯一-只需沿任意方向将其移动1英寸或cm。 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. 您可以编写一个Foxx服务,与之对话以存储新坐标。 All the required calculations and database transactions can be done there. 所有必需的计算和数据库事务都可以在那里完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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