Geography / Distinctions between Contains, Within, Intersects (and related) RRS feed

  • Question

  • Despite several hours of searching and reading numerous questions and answers on this forum and others, I have been unable to find definitive and complete explanations for the behaviors of several of the SQL Server CLR STXxx (spatiotemporal) functions.

    The documentation online - that I've been able to locate thus far - does not, for example, detail how much of one geography must be enclosed by another for a.STContains(b) to return 1, and conversely for a.STWithin(b). 

    Similar cases occur to me for Intersects; for example, if a we have a

    (P) Polygon(2 2, 2 10, 10 10, 10 2, 2 2),

    (A) LINESTRING( 3 3, 4 4, 5 5),

    (B) LINESTRING(1 1, 3 4, 6, 8),

    (C) LINESTRING(1 1, 3 4, 12 15),

    P.STContains(A) = 1 seems obvious.  P.STIntersects(B) = 1 and P.STIntersects(C) = 1 both seem obvious as well.  What about B.STWithin(P)?  Well most of the line exists within P, right? But P.STContains(B)?  Clearly not.

    Can anyone either direct me to an appropriate source that contains authoritative and explicit definitions for all geographies (or geometries) for these (and hopefully all) of the ST functions?

    Thank you very much for your help!

    Monday, May 20, 2013 4:38 PM