问题
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