-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Multiple geohashes decode to same lat/lon #63
Comments
to me this seems like a rounding issue. here's my workaround |
geoPHP conforms to the spec/reference of geohash.org (see also: https://en.wikipedia.org/wiki/Geohash) The second list of examples that you provide is actually incorrect as these provide a sense of accuracy that is false, anything beyond the integer values (or at least the thenths fraction) is made up, an artifact of the conversion. Also because you're using 4 chars the precision is different for lat and lon That doesn't mean our rounding is perfect or couldn't be enhanced, however I think your change actually introduces more error/noise than it solves. ps. if you want the squares/bounding boxes you should pass the $as_grid =TRUE to read(). |
thanks for the quick feedback. i'm not sure, if the implemented rounding really conforms to the spec. the wikipedia article states: "Final rounding should be done carefully in a way that i didn't double check manually, but the example from http://geohash.2ch.to/u26r stated that u26r maps to if those are correct, we should only round up to |
besides that, thanks for the pointer to pass the $as_grid =TRUE to read(). i should be able to use this workaround for calculating a center point within the application. the reason why this bugs me, is because for http://drupal.org/project/geocluster, i decided to use geohash prefixes for spatial clustering. this obviously doesn't work when i want to visualize clusters based on their geohash prefix and sometimes different geohash prefixes map to equal lat/lon points. |
I think you're correct on the rounding. I think you can force higher precision hashes using the |
@dasjo, would you be willing to create a pull request for this? |
hi,
i'm having a problem with decoding geohashes:
i can "reproduce" this here
http://geohash.org/u26r
http://geohash.org/u26q
on the other hand, these sites visualize those geohashes as different squares
u26r
latitude :47.724609
longitude:14.589844
u26q
latitude :47.548828
longitude:14.589844
http://geohash.2ch.to/u26r
http://geohash.2ch.to/u26q
http://openlocation.org/geohash/geohash-js/
http://geohash.gofreerange.com/
i'm confused, thanks for any clarification :)
The text was updated successfully, but these errors were encountered: