google-apps-script - 匹配 GPS 坐标

标签 google-apps-script google-sheets gps match lookup

我正在寻找一个匹配 GPS 坐标的工具。随附一张包含 GPS 坐标列表的表格。 https://docs.google.com/spreadsheets/d/1pCVlq7BEUBQyST0iRoPcgp_XUhUyOYjAuPQ3mfR5ehU/edit#gid=0

我尝试了数组,但无法从列中减去 1 个单元格,即使我这样做,也需要很长的方法。

您对我可以使用什么有什么建议吗? 我希望的理想情况是它检查坐标列表并突出显示多次存在的坐标,例如 300 米内。

我使用这个公式来计算两点之间的距离 = 111*SQRT((X1-X2)^2+(Y1-Y2)^2) GPS坐标的每一次变化,大约对应于地理尺度上的111公里。

最佳答案

解决方案

您可以通过在另一张工作表中创建所有点之间的距离矩阵并使用条件格式突出显示比特定距离更近的点对来检查比特定距离更近的坐标点。

实现此目的的步骤:

  1. 在电子表格中创建一个新工作表。
  2. 在第一个单元格中插入以下公式:

=ARRAYFORMULA(SQRT(POW(INDIRECT("Sheet1!$B"&(COLUMN(B2))))-Sheet1!$B2:$B340,2) + POW(INDIRECT("Sheet1!$C") “&(COLUMN(B2)))-Sheet1!$C2:$C340,2)))

Formula explanation : This formula calculates the euclidean distance between two coordinate points. I have used ARRAY FORMULA to automatically calculate the distance between the first point with the rest of the coordinates of your GPS signal. Note that indirect is used so that you can propagate this formula to the rest of the columns. In this case I am testing with 340 coordinate points but you can increase this as you want.

  • 选择您在其中写入公式的单元格并将其拖过各列,直到达到元素总数。 (当 0 对角线到达最后一行值时,您可以轻松检查这一点)。
  • 选择您的整个范围(矩阵)并转到格式 -> 条件格式,然后在用户界面中的小于或等于中选择您想要输入的距离作为极限。
  • 通过这种方式,您将获得距离矩阵,告诉您哪些交点比特定距离更近。这是一个示例图像(距离小于 0.4):

    enter image description here

    使用的资源:

    ARRAYFORUMLA, POW, INDIRECT, Conditional Formatting

    关于google-apps-script - 匹配 GPS 坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60971626/

    相关文章:

    javascript - 如何在 Google 表格的对话框中添加重置按钮

    android - 等到 GPS 启用后再获取 FusedLocationAPI 中的纬度和经度值

    ionic-framework - switchToLocationSettings()后如何检测gps是否启用?

    php - mysql查询结果到可点击的url

    javascript - 访问、解析和写入 .csv 数据 - google apps 脚本

    button - 如何制作一个按钮跳转到 Google 电子表格中另一个工作表中的特定单元格?

    javascript - Google Apps 脚本中的 Hmac 签名,当 Secret 和 Digest 是 base64 编码时

    google-apps-script - 无法更改我的 Google 表格插件的版本

    image - 在谷歌电子表格中使图像可点击

    google-sheets - 将字符串解析为单元格的 Google 电子表格公式