scottschluer / geolocation

A C# class library that will calculate distance and cardinal direction between two sets of coordinates and provides the lat/long boundaries around an origin coordinate allowing for simple SQL or LINQ selection of locations within the given radius.
MIT License
203 stars 46 forks source link

International System of Units -> Km (not Miles) #20

Open Jerome-Liger opened 2 years ago

Jerome-Liger commented 2 years ago

Why american's developers only calculate distance with miles and never think about all the rest of the "standardized-world-developers" ?

Please, use the ISU (International System of Units) by default... it has been released in 1960... so any length must be expressed in meters (or cm/Km/...)

https://en.wikipedia.org/wiki/International_System_of_Units

And if you want to add an overload/option to get the result on miles, I'm not against ;-) (For example, MAUI Location Extension ask the unit (Km or Miles) in parameter : https://www.andreasnesheim.no/calculating-distance-between-your-device-and-a-location-with-net-maui/)

Some rockets have already exploded in the past for this kind of imperial units problems... with unfortunate human deaths.

madelson commented 1 year ago

I think DistanceUnit should be a required parameter. If I just see GeoCalculator.GetDistance(a, b), it is not clear what that distance is measured in (meters? km?).

Furthermore, Changing the default DistanceUnit from Miles to Meters/Kilometers should come with a major version bump since just upgrading would break anyone using the default without their knowing it. However, removing the default would only be a source-level break so this would not require a major bump.