gpt4 book ai didi

map - 有哪些有效的 Geohash 边界框覆盖算法?

转载 作者:行者123 更新时间:2023-12-04 00:41:35 26 4
gpt4 key购买 nike

我的要求是:

给定一个经纬度边界框,返回一组 geohashes,使得:

  • 集合中的 geohash 数量应该很少(1 到 5 个 geohash
    矩形)如果可能。
  • 覆盖范围应尽可能接近输入纬度边界框
    可能的。公差约为 +/- 10%。覆盖和/或覆盖一点点是可以的。
  • 它应该是高效的并且可以在移动设备上执行

  • 我对算法或概念方法最感兴趣。如果不存在开源实现,我计划在 Android 和 iOS 的 Java/Obj-C 中实现它。

    最佳答案

    github上的这个java项目https://github.com/davidmoten/geo有一个文档化的算法来做你想做的事。特别是它在 geohash 区域(即极点和 -180/180 经度线)的边界处也能很好地工作。

    保持 geohashes 的数量很小(1 到 5)以及大约 10% 的容忍度不会飞我害怕。只有 5 个 geohashes,许多矩形将在目标矩形区域的 600% 处被 geohashes 覆盖。事实上,对于下面的示例,进入该区域的 10% 需要 667 个哈希值!

    这是从地理项目站点上的自述文件中获取的表格:

    As a quick example, for a bounding box proportioned more a less like a screen with Schenectady NY and Hartford CT in USA at the corners:

    Here are the hash counts for different hash lengths:

    m is the size in square degrees of the total hashed area and a is the area of the bounding box.



    长度 numHashes m/a
    1 1 1694
    2 1 53
    3 4 6.6
    4 30 1.6
    5 667 1.08
    6 20227 1.02

    所使用的算法是高效的,并且相关代码不依赖于其他工件,因此部署到支持 java(如 Android)的移动设备不会有问题。

    关于map - 有哪些有效的 Geohash 边界框覆盖算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18324524/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com