Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
STPointOnSurface()似乎总是返回相同的点。如何在 SQL Server 中生成位于几何内部的随机点?
STPointOnSurface()
使用在 WHERE 子句中定义的表面范围的 CTE,但为 SELECT 中返回的每个点添加一个行号。然后查询您的 CTE,但使用您在 CTE 中分配的行号选择具有随机行号的点。
这假设您正在谈论由点云而不是由边界/边缘定义的表面。如果您的数据由边界/边缘定义,那么您可以使用带有随机修饰符的简单距离公式。