Skip to content

Instantly share code, notes, and snippets.

Avatar

Wei Jing HydJing

View GitHub Profile
@HydJing
HydJing / average-geolocation.js
Created Mar 1, 2018 — forked from tlhunter/average-geolocation.js
Calculate the center/average of multiple GeoLocation coordinates
View average-geolocation.js
/**
* Calculate the center/average of multiple GeoLocation coordinates
* Expects an array of objects with .latitude and .longitude properties
*
* @url http://stackoverflow.com/a/14231286/538646
*/
function averageGeolocation(coords) {
if (coords.length === 1) {
return coords[0];
}
You can’t perform that action at this time.