在SQL Server中将STCrosses()与空间索引一起使用 [英] Using STCrosses() with a Spatial Index in SQL Server

查看:202
本文介绍了在SQL Server中将STCrosses()与空间索引一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于地理数据的Microsoft StCrosses()函数是否支持空间索引?

Does The Microsoft StCrosses() function for Geography data support Spatial Index?

当我尝试使用空间索引执行此功能时,出现以下错误消息:

When I try to execute this function with Spatial Index I get this error message:

查询处理器无法为具有空间索引提示的查询生成查询计划.原因:空间索引不支持谓词中提供的方法名称.请尝试删除索引提示或删除SET FORCEPLAN".

"The query processor could not produce a query plan for a query with a spatial index hint. Reason: Spatial indexes do not support the method name supplied in the predicate. Try removing the index hints or removing SET FORCEPLAN"

推荐答案

否.

为空间数据编制索引并非易事,正在讨论的类可以包含任意复杂的图形,而不仅仅是简单的几何形状.在一般情况下,实现形状和索引的特定方式可能使查找重叠变得困难或不可能.它也不基于复杂几何图形的空间数据索引.这就是为什么您不能要求SQL仅使用索引的原因-那里的数据不足.在简并的情况下,可能会出现,但它不知道,因此将其关闭.

Indexing spatial data is nontrivial, and the class you are discussing can contain arbitrarily complex figures, not just simple geometric shapes. The specific way shapes and indexing is implemented can make finding overlaps difficult or impossible in the general case. It's also not based on whatever is indexed of the spatial data for complex geometries. This may be why you can't require SQL to only use the index - there is not enough data there. In the degenerate case there may be, but it would not know that, so it is turned off.

想象一下,有一个星形,里面嵌有复杂的东西.索引只能存储外部形状的边界,形状的中心或边界矩形.这些都不足以计算2个形状的相交,或者这些形状实际上重叠.

Imagine having a star-shape, with complex things embedded in it. The index may only store the boundary of the outer shpe, or the center of the shape, or the bounding rectangle. None of these would be enough to compute the intersect of 2 shapes, or if the shapes actually overlap.

请参见 http://msdn.microsoft.com/zh-CN/library/bb895265.aspx#geometry 以确认不支持该功能.

See http://msdn.microsoft.com/en-us/library/bb895265.aspx#geometry to confirm that it is not supported.

这篇关于在SQL Server中将STCrosses()与空间索引一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆