简体   繁体   English

如何将多边形延伸到一定距离?

[英]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 在每个顶点中建立外部平分线向量(作为两个相邻边的归一化法线nanb之和)并将其归一化

在此处输入图片说明

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是向量nanb之间的夹角。

 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.

相关问题 如何仅从 BigQuery 中的多边形找到到最近线串的距离? - How to find only the distance to the closest linestring from a polygon in BigQuery? 如何获取距已知经度和纬度一定距离内的地方的经度和纬度 - How to get longitude and latitude for a place within certain distance from a known longitude and latitude 如何在MySQL查询中查找距经纬度一定距离的点 - How to find if point within a certain distance from latitude, longitude as MySQL query 如何在 MySQL 中使用多边形存储多边形坐标 - How to store polygon coordinates using polygon in the MySQL 如何延长服务器超时时间? - How to extend server timeout? 使用Oracle SQL空间函数来计算点与围绕该点的多边形的周长之间的距离? - Using Oracle SQL spatial functions to calculate the distance between a point and the perimeter of the polygon that surrounds that point? 为什么 st_distance('polygon from northpole', 'point in italy') 结果给我'0'? - Why st_distance('polygon from north pole', 'point in italy') gives me '0' as a result? PostGis在距线一定距离的多个表中查找点 - PostGis find points from multiple tables in certain distance from line 如何延长SQL查询的超时 - How to extend the timeout of a SQL query 如何在SQL上改善距离计算 - How to improve distance calculation on SQL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM