manuelbieh / geolib

Zero dependency library to provide some basic geo functions
MIT License
4.23k stars 341 forks source link

getCenter() returns distance in km, not meters #48

Closed jd327 closed 9 years ago

jd327 commented 9 years ago

You have distance as meters everywhere in your documentation, but getCenter returns kilometers. geolib@2.0.14

manuelbieh commented 9 years ago

Do you really need the distance at all? It was dropped completely in 2.0.15. I should remove it from the docs, unless you tell me that you need this value (and what you need it for :wink: ).

jd327 commented 9 years ago

I'm using this function for store locator software to calculate the distance between users and stores. It seems like basic geo calculation that a geo library should support, what were the reasons for dropping it?

manuelbieh commented 9 years ago

That's what geolib.getDistance(src, dest) is meant for.

geolib.getCenter(poly) is just to give you the center point of a polygon.

manuelbieh commented 9 years ago

Example: var distanceFromUserToStore = geolib.getDistance(userPosition, storePosition);