Skip to content

Instantly share code, notes, and snippets.

@oliverbenns
Last active May 15, 2017 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oliverbenns/a2b3598e21f80fd8a12ae27f3110793d to your computer and use it in GitHub Desktop.
Save oliverbenns/a2b3598e21f80fd8a12ae27f3110793d to your computer and use it in GitHub Desktop.
Google Map Area (Square) Calculator
const lngRadius = 0.25;
const point = {
lat: 51.507351,
lng: -0.127758,
};
const latmin = point.lat - lngRadius;
const latmax = point.lat + lngRadius;
const lngmin = point.lng - (lngRadius / 85 * 180); // Number of units different from lng so need to calculate
const lngmax = point.lng + (lngRadius / 85 * 180);
// min
console.log(`${latmin}, ${lngmin}`)
// max
console.log(`${latmax}, ${lngmax}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment