Closed EskelCz closed 5 years ago
[lng, lat]
is the most widely used standard for locations in JavaScript because it's a part of the GeoJSON specification. If you have your data in a different format, converting to GeoJSON coordinates is trivial:
const convert = ({latitude, longitude}) => [longitude, latitude];
const distance = ruler.distance(convert(a), convert(b));
Well I know it's trivial, it just looks a bit messy. Here's the fork for anyone who wants the object data format. https://github.com/EskelCz/cheap-ruler
@mourner Thanks for this library, I love it. :) But I have a slight issue with its integration into my project. Most other geolocation libraries I'm using are storing location data as an object, in this format:
{ latitude: Number, longitude: Number }
For example Google Firestore is using such format: https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/GeoPointSo I'd like to modify cheapRuler to use this format as well, to keep my code clean.
My question is, would that be something that you would support? Is so, how would you go about the implementation? So I can do it correctly and open a PR. Otherwise I will just create a fork where I simply change the format a post a link here.