maximveksler / GeohashKit

Fast, accurate, fully tested geohashing library for Swift
MIT License
47 stars 11 forks source link

Improve calculated precision of hash code #1

Open maximveksler opened 9 years ago

maximveksler commented 9 years ago

Currently precision, is hard coded by measuring bounding box lat / lon is below 0.5 deg. It would be wise to improve the way hash precision is calculated by following a “significantly more precise” measurements.

Suggestion: For (each new hash precision cycle), check if calculating the precision is wise, by measuring the precious distance for lat,lon from the previous bounding box, calculate distance for

    case North // Top
    case South // Bottom
    case East // Right
    case West  // Left

then, complete first iteration of new hash loop, and check if either lat or lon precision has been imported by at least 25% compared to previous measurement, if so - continue, else break the calculation loop.