Start Engine Start Engine - 1 month ago 18
Javascript Question

a library that assumes spherical earth and let me divide map to squires?

I want to calculate distance between two geo coordinates but because of hardware usage (cpu, ram, database usage) I don't want to be specific instead I want to divide map to squires of my choice for example 1 Km * 1 km squires is there any library out there to do this pereferly for java-scrip language I couldn't find any
ps library to calculating distance between this two squires

thank you very much for your time

Answer

If you want to slightly obfuscate the user's location, then rather than assigning them to a grid, you might effectively do the same thing by rounding off their latitudes and longitudes to however many decimal places you like then computing the distance using a more traditional Haversine Formula.

This post Calculate distance between... has many such implementations, but the one you want (javascript wise) is from @Salvador Dali.

If you are still looking to move forward with the "squire" concept, then check out http://what3words.com/ as they seem to be doing something similar to what you are looking to do though perhaps at a higher level of precision and they have an API.