[英]How to extend the polygon to a certain distance?
How to extend the polygon to a certain distance? 如何将多边形延伸到一定距离? I create a convex hull around the multipoint.
我围绕多点创建一个凸包。 But I need to extend the range to several kilometers.
但是我需要将范围扩大到几公里。 At least in theory.
至少在理论上。
http://img.radiokot.ru/files/21274/1oykzc5pez.png http://img.radiokot.ru/files/21274/1oykzc5pez.png
Build outer bisector vector in every vertex (as sum of normalized normals na
and nb
of two neighbor edges) and normalize it 在每个顶点中建立外部平分线向量(作为两个相邻边的归一化法线
na
和nb
之和)并将其归一化
bis = na + nb
bis = bis / Length(bis)
Make length of bisector to provide needed distance as 使等分线的长度提供所需的距离为
l = d / Cos(fi/2)
where d is offset, and fi is angle between vectors na
and nb
. 其中d是偏移量,fi是向量
na
和nb
之间的夹角。
fi = atan2(crossproduct(na,nb), dotproduct(na,nb))
or without trigonometric functions: 或不具有三角函数:
l = d / Sqrt(1 + dotproduct(na,nb))
And find offset polygon vertex: 并找到偏移多边形顶点:
P' = P + l * bis
Assuming that you're able to get a convex hull (which maybe you're using ConvexHullAggregate
!), STBuffer()
should do what you want. 假设您能够获得凸包(也许您正在使用
ConvexHullAggregate
!),则STBuffer()
应该做您想要的事情。
declare @hull geography = «your value here»;
select @hull.STBuffer(10000); -- 10 km buffer
NB: the 10000
may need to change based on the SRID that you're using since SRIDs have units of distance baked into them inherently. 注意:
10000
可能需要根据您使用的SRID进行更改,因为SRID具有固有的距离单位。 But SRID 4326 is what's used in the docs most often and the native unit for that SRID is meters. 但是SRID 4326是文档中最常用的,并且该SRID的本机单位是米。 So 10 km → 10000 m.
所以10公里→10000 m
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.