Polygon 使用T-Sql实现多边形中的点

Polygon 使用T-Sql实现多边形中的点,polygon,Polygon,我正在创建一个映射应用程序,用户可以在谷歌地图上以交互方式绘制多边形 我需要将这些多边形数据发送回Sql Server,并根据它们在多边形内的数据库中的位置确定要返回的记录 有没有人知道如何做这件事,或者知道一个可用的例行程序。 提前感谢如果您有一个与记录关联的地理列,您可以使用它来查询多边形中的项目。让你开始。下面是一个例子: --What Items are within the Bermuda Triangle? ---Note that Well-Known Text represen

我正在创建一个映射应用程序,用户可以在谷歌地图上以交互方式绘制多边形

我需要将这些多边形数据发送回Sql Server,并根据它们在多边形内的数据库中的位置确定要返回的记录

有没有人知道如何做这件事,或者知道一个可用的例行程序。
提前感谢

如果您有一个与记录关联的地理列,您可以使用它来查询多边形中的项目。让你开始。下面是一个例子:

--What Items are within the Bermuda Triangle? 
---Note that Well-Known Text representation of a polygon is composed of points defined by Longitude then Latitude.
---Note that the points are defined in a counter-clockwise order so that the polygon is the interior of the triangle.  
DECLARE @BermudaTriangle geography = geography::STPolyFromText
('POLYGON((
    -80.190262  25.774252,
    -66.118292 18.466465,
    -64.75737 32.321384,
    -80.190262 25.774252
))', 4326)

SELECT ItemID, ReportedGPSPoint.Lat, ReportedGPSPoint.Long
FROM Items
WHERE ReportedGPSPoint.STIntersects(@BermudaTriangle) = 1

非常感谢您的回复。但我的问题是如何从谷歌地图上的多边形中以正确的逆时针顺序获得坐标。我想这将是一个单独的问题。将其作为单独的问题发布,使用。