如何在python中以给定点(lat,long)和距离的给定点(lat,long)和距离获取边界框(minx,miny,maxx,maxy)?
如何使用给定点(LAT,长)和以python为单位(lat,long)的边界盒(Minx,Miny,Maxx,Maxy)元组?
给定的距离是我要寻找的边界框的对角线的一半。
paris_point = (48.8588548, 2.347035)
distance_km = 20
#Get bounding_box
def get_bounding_box(point, distance):
???
return (minx, miny, maxx, maxy)
result = get_bounding_box(paris_point, distance_km)
Minx是西南角的经度,
是西南角的纬度
Maxx的纬度是东北角Maxy的经度,
Maxy是东北角的纬度,
我尝试了Geopandas,但我什么也没发现... 有没有可以做到这一点的自由?
你能帮我吗? 谢谢
How to get bounding-box (minx, miny, maxx, maxy) tuple for an given point (lat, long) and given distance in kilometers (int or float) with python ?
The given distance is the half of the diagonal of the bounding-box I am looking for.
paris_point = (48.8588548, 2.347035)
distance_km = 20
#Get bounding_box
def get_bounding_box(point, distance):
???
return (minx, miny, maxx, maxy)
result = get_bounding_box(paris_point, distance_km)
minx is the longitude of the southwestern corner
miny is the latitude of the southwestern corner
maxx is the longitude of the northeastern corner
maxy is the latitude of the northeastern corner
I try with geopandas but I don't find anything...
Is there a lib that can do this?
Can you help me please ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在此上下文中的边界框可能会令人困惑,因为只有一个点对象。让我们称其为正方形缓冲区。
geopanadas 在这里有点过分,它便利地包装&amp&amp;提供您需要的所有功能。但是,对于较少的依赖项,您可以使用它的基础库 - shapely &amp; <
在大多数用例中,使用圆形缓冲区和半径而不是方形缓冲区以及从中心到角落的距离可能更为实用。
Bounding box in this context can be bit confusing as there's only a single point object. Lets just call it a square buffer.
While Geopanadas is kind of overkill here, it conveniently wraps & provides all the functions you'd need. But for less dependencies you could use it's underlying libraries - Shapely & pyproj - directly as well.
For most use cases it's probably more practical to use a round buffer and radius instead of square buffer and distance from center to the corner.