geohash and max distance

ぐ巨炮叔叔 提交于 2019-12-18 10:58:06

问题


Two geohash with first 6 characters matching, distance between two geohash is max 0.61km Two geohash with first 5 characters matching, distance between two geohash is max 2.5km

Q : What is the max distance (approx) between any pair of bounding box of given geohash of 5 digit length


回答1:


The distance between two adjacent geohashes depends on the latitude & longitude of the center points. In order to get an accurate distance of your bounding box you need to get the adjacent boxes, calculate their center lat/lon and get the distance.

For example, to the get distance of each geohash in dqcjqcperh9tdqcj, you will get the following distances for adjacent boxes. Keep in mind that these numbers change slightly as the center geohash changes.

Precision, Distance of Adjacent Cell in Meters
1, 5003530
2, 625441
3, 123264
4, 19545
5, 3803
6, 610
7, 118
8, 19
9, 3.71
10, 0.6

I would calculate the center point of each bounding box and calculate the distance using one of the formulas listed here http://www.movable-type.co.uk/scripts/latlong.html

Here is a good javascript library that calculates adjacent geohashes and provides lat/lons to use for calculations. https://github.com/davetroy/geohash-js



来源:https://stackoverflow.com/questions/13836416/geohash-and-max-distance

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!