(LAT,LON)坐标的两个点元组之间的地质距离
我一直在尝试测量地理框架(gdb ['几何'])中点之间的地理距离,并且一个特定的点,例如,b_xy。
GDB ['几何形状']是一个地质塔布酶,其中包含LON/LAT坐标的元素:
几何 |
---|
点(-73.958 40.685) |
点(-73.995 40.663) |
点(-73.982 40.756) |
,而B_xy是简单的LON/LAT/LAT坐标: (40.7572805500004,-73.985855503545917)
他声称在此示例中使用的教科书/教程给我的教授的代码是这样的:
'd2b = lambda pt:cdist:cdist: [b_xy])[0] [0]*10 #hasilnya学位/弧度 gdb ['d2tsquare'] = gdb ['几何']。to_crs(tgt_crs)
。
www.section.io/eendineering-education/using-eepopy-to-to-calculate-the-distance-betance-betance-bet---------------仪表。但是,地理距离无法从元组中计算出来,只能执行单数输入。它不能接受GeodataFrame的数据。
对于一种有效的方法,我在这里不知所措。一直在考虑为此循环,但不确定从哪里开始。
I've been trying to measure geographic distance between points in a GeoDataframe (gdb['geometry']) and one specific point, let's say, b_xy.
gdb['geometry'] is a geodatabase containing tuples of lon/lat coordinates as such:
geometry |
---|
POINT (-73.958 40.685) |
POINT (-73.995 40.663) |
POINT (-73.982 40.756) |
Whereas b_xy is a simple lon/lat coordinate:
(40.757280550000004, -73.98585503545917)
The code given to my professor from the textbook/tutorial he claims to be using for this example, is as such:
'd2b = lambda pt: cdist([(pt.x, pt.y)], [b_xy])[0][0]*10 #hasilnya degrees/radians
gdb['d2tsquare'] = gdb['geometry'].to_crs(tgt_crs)
.apply(d2b)'
which gives out a weird output that is presumably in degrees/radians, despite using a projected crs for tgt_crs
I've been trying to use this tutorial on measuring distances between two points, in meters. However, geopy.distance is unable to calculate from a tuple and can only perform singular inputs; it cannot accept data from a geodataframe.
I'm at a loss here for a method that works. Been thinking about making a loop for it but not sure where to start.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题被部分回答在这里。但是在这里添加一些价值是您要做的。
输出为:279.35290160430094
这是公里的距离
This question is partially answered here. but to add some value here is what you want to do.
Output is : 279.35290160430094
which is the distance in km
您可以使用UTM CRS将EPSG转换为4386坐标为米,因此距离计算将是仪表。
You can use UTM CRS to transform epsg:4386 co-ordinates into meters so distance calculation will be meters.