0
我有一個確定的點是多邊形內或不什麼是平等的SQL函數或StoredProcedure的我的C#方法
C#方法是這樣的這個C#方法:
/// <summary>
/// Determine that a point in inside a polygon or not
/// </summary>
/// <param name="points">Points of Polygon</param>
/// <param name="point">Test Point</param>
/// <returns></returns>
Public bool IsInside(List<PointF> points,PointF point)
{
int i, j,n=points.Count;
bool c = false;
for (i = 0, j = n - 1; i < n; j = i++)
{
if (((points[i].Y > point.Y) != (points[j].Y > point.Y)) &&
(point.X <
(points[j].X - points[i].X)*(point.Y - points[i].Y)/(points[j].Y - points[i].Y) + points[i].X))
c = !c;
}
return c;
}
我如何轉換這到SQL函數或StoredProcedure?
@ a_horse_with_no_name Microsoft SQL SERVER 2016 – Ali7091
創建兩個幾何實例並使用['STContains'](https://msdn.microsoft.com/en-gb/library/bb933904.aspx) –
一個想法:您可以通過列表的點作爲xml數據,並將x和y參數指向您的函數或存儲過程。在存儲過程或函數內部使用openxml將xml數據加載到表中(在函數中,您需要表變量)。然後運行select查詢,並將if條件的條件放在where子句中。 –