简体   繁体   English

如何在多边形和点geometryfile之间执行STIntersect?

[英]How to perform STIntersect between a polygon and point geometryfile?

What I have so far: 到目前为止,我有:

select Metro.Object_ID 
from Geocoding_tab.dbo.Part1_Part2_Combined_Final as paypal
    ,Object_id.dbo.All_Combined_9_Metros as Metro
where paypal.geom.STIntersect(Metro.GEOM) = 1;

You can amend the query to use JOIN syntax 您可以修改查询以使用JOIN语法

SELECT Metro.Object_ID 
FROM
    Geocoding_tab.dbo.Part1_Part2_Combined_Final as paypal
INNER JOIN 
    Object_id.dbo.All_Combined_9_Metros as Metro ON paypal.geom.STIntersects(Metro.GEOM) = 1;

EDIT - following error shown in comments below 编辑 -以下评论中显示的以下错误

You can use the STIsValid Method to detect if you have shape that's invalid. 您可以使用STIsValid方法来检测形状是否无效。 The method will return 0 if invalid. 如果无效,该方法将返回0。

The MakeValid Method will fix invalid shape data MakeValid方法将修复无效的形状数据

for example: 例如:

UPDATE table SET geom = geom.MakeValid() where geom.STIsValid() = 0

Note 注意

As the error suggests, the MakeValid could alter your shape in a way that you might consider incorrect, depending on the original problem with the shape. 如错误所示,MakeValid可能会以您认为不正确的方式更改形状,具体取决于形状的原始问题。 So you should confirm that you're happy with the "corrected" shape before proceeding. 因此,在继续操作之前,您应该确认对“更正”的形状感到满意。

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

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