dcousens/haversine-distance

Support GeoJSON Point representation

VinceBT opened this issue · 5 comments

In GeoJSON format, point coordinates are represented by an array like this: [longitude, latitude]
A support would increase the use cases of this library

@VinceBT the implementation wouldn't be difficult.

Array.isArray check, then unpack.
Is it worth using the same export though, or an overload? (e.g harversine-distance/geojson)

I think that it does not need a different export. Handling all kinds of representation in the same function seems more user friendly.

@VinceBT my only concern, is that this continue to happen for every possible syntax of lat and lon?

I don't see any other very popular representations that could be added, in my opinion.

OK, @VinceBT please submit a PR, otherwise it might be a while before I can do this