简体   繁体   English

使用cts:circle-intersect在Marklogic 7中搜索多边形中的点/圆

[英]Point/circle in polygons search in Marklogic 7 using cts:circle-intersect

I have a list of around 1100 polygons to iterate through in $polygons (none of them overlapping each other) and I need to find to which polygon my point or circle with a 1 mile radius belongs/intersects. 我有一个大约1100个多边形的列表来迭代$多边形(它们没有相互重叠)我需要找到我的点或半径为1英里的圆属于哪个多边形/相交。 I used the function below and it takes about 1 second and a half, which is good, but I was wondering, is there is another better/faster approach to it? 我使用下面的功能,它需要大约1秒半,这是好的,但我想知道,还有另一种更好/更快的方法吗? I read about R/M-tree algorithms, but I don't have any rectangle hierarchies indexed inside the DB. 我读到了R / M树算法,但我没有在DB内部索引的任何矩形层次结构。 I'm also trying cts:polygon-intersect to see if it is faster, but I doubt it. 我也在尝试cts:polygon-intersect以查看它是否更快,但我对此表示怀疑。

cts:circle-intersects(cts:circle(1,cts:point(5.8864790,51.0006240)), $polygons) cts:circle-intersects(cts:circle(1,cts:point(5.8864790,51.0006240)),$ polygons)

You can use cts:bounding-boxes to get bounding boxes (of varying granularity in the case of the polygons) and check whether they overlap, and only go to the more expensive check if they do. 您可以使用cts:bounding-boxes来获取边界框(在多边形的情况下具有不同的粒度)并检查它们是否重叠,并且只有它们才会进行更昂贵的检查。 Checking whether two boxes intersect is very quick. 检查两个盒子是否相交非常快。

So far, cts:circle-intersects is the fastest, iterates in 1.3 seconds between all the 1100+ polygons. 到目前为止,cts:circle-intersects是最快的,在所有1100多个多边形之间的1.3秒内迭代。 I've tried cts:polygon-intersects and cts:region-intersects also. 我试过cts:polygon-intersects和cts:region-intersects也。 Since this is not a very critical task in order to apply some fancy and speedy algorithms I will leave it like this for the moment. 由于这不是一个非常关键的任务,为了应用一些花哨和快速的算法,我暂时会这样做。

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

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