找到包围现有边界矩形顶点的四个圆的边界矩形的坐标。

huangapple go评论75阅读模式
英文:

How to find the coodinates of the bounding rectangle from four circles around the vertices of an existing bounding rectangle

问题

我有一个已经创建好的边界框。我知道边界框的四个顶点的经纬度。在这些顶点上,我创建了半径为10米的缓冲圆,现在我想计算一个新的边界框,它包含这四个圆。

我创建了四个圆,我知道每个圆上点的经纬度。如何在Python中创建并找到这个新矩形/边界框的四个端点坐标,以包围这四个圆。

英文:

I have a bounding box which I have created. I know the lat lon of the four vertices of the box. On these vertices I have created a buffer circle of radius 10m and now I want to calculate a new bounding box which covers these four circles.

I have created four circles where I know the lat,lon of each points which makes the circle. How can I make and find the coordinates of the 4 ends of this new rectangle/bounding box which encloses these four circles in python.

Sample Image

答案1

得分: 1

以下是翻译好的部分:

对于纬度/经度对齐的矩形,10米的距离对应角度偏移

ltdiff = 180 * 10 / 20 000 000 = 0.00009
沿纬度方向的度数

lndiff = 180 * 10 / 20 000 000 / cos(lat) = 0.00009/cos(lat)
沿经度方向的度数

例如,对于纬度45度北:

lndiff = 0.00009/cos(45) = 0.00009/0.7071 = 0.0001273 度
因此,通过这些值扩展您的矩形(对于小矩形,顶部和底部的纬度几乎相同,因此您可以使用相同的余弦值)

newtopleft.lat = topleft.lat - 0.00009
newtopleft.lon = topleft.lon - 0.00009/cos(topleft.lat)

newtopright.lat = topright.lat - 0.00009
newtopright.lon = topright.lon + 0.00009/cos(topright.lat)

底部左侧和右侧同样如此。

英文:

For lat/lon aligned rectangle 10m distance correspond to angular shift

ltdiff = 180 * 10 / 20 000 000  = 0.00009

degrees along latitude

and

lndiff = 180 * 10 / 20 000 000 / cos(lat)  = 0.00009/cos(lat)

degrees along longitude

For example, for latitude 45n:

lndiff = 0.00009/cos(45) = 0.00009/0.7071 = 0.0001273 degrees

So expand you rectangle by these values (for small rectangles top and bottom latitude is nearly the same, so you can use the same value for cosine)

newtopleft.lat = topleft.lat - 0.00009 
newtopleft.lon = topleft.lon - 0.00009/cos(topleft.lat)

newtopright.lat = topright.lat - 0.00009 
newtopright.lon = topright.lon + 0.00009/cos(topright.lat)

similar for bottom left and right

huangapple
  • 本文由 发表于 2023年7月6日 16:40:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76626998.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定