STintersects()查找相交点 [英] STintersects() to find the Intersection point

查看:468
本文介绍了STintersects()查找相交点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个SQL Server geometry -ies,我正在使用它们检查它们是否相交.如果需要,我需要交点.

I have two sql server geometry-ies which I am using to check if they intersect. If they do I need the intersection point.

当前,我只能得到布尔输出,如果它与intersects = 1不相交,它将给出=0.有什么办法可以在geometry中找到两个形状的交点?

Currently I can get only Boolean output where if it intersects = 1 and if it does not intersect it will give =0 . Is there any way I can find the intersection of two shapes in geometry?

更新 这个问题引出了我的下一个问题,即如何检查一个点(纬度/经度)是否在具有4000点(纬度/经度)的区域中).一个人可以在地理上使用stcontains或stintersects吗?

Update this question led to my next question concerning how can one check if a point (lat/long) exists in a region which has 4000 points (lat/long). Can one use stcontains or stintersects on geography?

sql-ST包含地理"列

推荐答案

DECLARE @line1 GEOMETRY = geometry::STGeomFromText('LINESTRING(0 0, 1 1)', 0)
DECLARE @line2 GEOMETRY = geometry::STGeomFromText('LINESTRING(1 0, 0 1)', 0)

SELECT  @line1.STIntersection(@line2).ToString()

这篇关于STintersects()查找相交点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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