有效使用EnvelopeAggregate [英] Efficient use of EnvelopeAggregate
问题描述
你好!
我需要计算大型多边形表的边界框。即包含表中所有几何的聚合边界框。多边形存储在表中的
几何列中,该列已编制索引。 我是否可以使用列上的空间索引来执行此操作?
我试过Geometry :: EnvelopeAggregate ()。它似乎是使用顺序扫描,而不是使用索引。这可能是它的实现方式,但我在这里发布
,希望我错过了什么。我想要的是类似于min()和max()聚合函数在索引列上运行得更快。或者类似的包络函数在基于R树的空间索引实现上工作得更快。
如果多边形存储在地理列中,您的答案会不同吗?
对于Geometry类型,我知道我可以查询边界索引是使用这样的查询创建的,但这会返回创建
索引的边界框,而不是'true'聚合包络。
< p style =""> 选择b.name,
&NBSP;&NBSP; a.bounding_box_xmin,bounding_box_ymin,bounding_box_xmax,bounding_box_ymax
来自sys.spatial_index_tessellations a,sys.spatial_indexes b
其中b.object_id = a.object_id和b.name喜欢< index_name> ;;
感谢您的帮助。
Anand。
Hi
Anand,
请参考博客和类似问题。
问题:
https://stackoverflow.com/questions/16410757/bounding-box-for-polygon
最好的问候,
艾米丽
Hi there!
I need to compute the bounding box of a large table of polygons. i.e. the aggregate bounding box that encloses all geometries in the table. The polygons are stored in a Geometry column in a table, which is indexed. Is there a way for me to do this using the spatial index on the column?
I tried Geometry::EnvelopeAggregate(). It appears to be using a sequential scan, rather than use the index. That may be how it is implemented, but I am posting here, hoping I missed something. What I want is analogous to min() and max() aggregate functions working faster on an indexed column. Or comparable envelope functions working faster on R-tree based spatial index implementations.
Will your answer be different if the polygons were stored in a Geography column?
For the Geometry type, I know I can query the bounds that the index was created with using a query like this, but this returns the bounding box the index was created with, rather than the ‘true’ aggregate envelope.
select b.name, a.bounding_box_xmin, bounding_box_ymin, bounding_box_xmax, bounding_box_ymax
from sys.spatial_index_tessellations a, sys.spatial_indexes b
where b.object_id = a.object_id and b.name like <index_name>;
Thanks for your help.
Anand.
Hi Anand,
Please refer to the blog and the similar question.
Question: https://stackoverflow.com/questions/16410757/bounding-box-for-polygon
Best Regards,
Emily
这篇关于有效使用EnvelopeAggregate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!