在表格中使用经纬度计算距离 [英] Calculation of distance using lat long in tableau

查看:81
本文介绍了在表格中使用经纬度计算距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据文件,其中有数百万行,其中 lat long 列为列中字段的2.

I have a data file with millions of rows with lat and long columns as 2 of the field in the columns.

想问一下是否有任何方法可以使用 lat 字段

Would like to ask if there is any ways to calculate the total distance for (e.g. Model X "Index 0 --> Index1 , Index 1--> Index 3" ) using the lat long field

Index,Model,lat,long
0,X,1.3539,103.84
1,X,1.3545,103.84
2,Y,1.3839,103.7002
3,X,1.3548,103.84
4,Y,1.3831,103.71
5,Z,1.3139,103.88

请指教!

推荐答案

此公式将计算距离.但是要使其工作,您将需要使用lookup()函数查看下一行,或者以某种方式旋转数据,以便在同一行上具有两组坐标.

This formula will calculate distance. But to make it work, you'll need to either use the lookup() function to look at the next row or somehow pivot your data so that you have two sets of coordinates on the same row.

3959 * ACOS 
( 
SIN(RADIANS([Lat])) * SIN(RADIANS([Lat2])) + 
COS(RADIANS([Lat])) * COS(RADIANS([Lat2])) * COS(RADIANS([Long2]) - RADIANS([Long])) 
)

这篇关于在表格中使用经纬度计算距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆