STintersects() to find the Intersection point

妖精的绣舞 提交于 2019-12-23 19:18:17

问题


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

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?


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 - STContains on Geography column


回答1:


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()


来源:https://stackoverflow.com/questions/13259215/stintersects-to-find-the-intersection-point

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!