Skip to content

Instantly share code, notes, and snippets.

@the-teacher
Created August 15, 2013 05:42
Show Gist options
  • Save the-teacher/6238542 to your computer and use it in GitHub Desktop.
Save the-teacher/6238542 to your computer and use it in GitHub Desktop.
lng_corr = 250 / (Math.cos(coordinates[1] * Math.PI / 180) * 111.11) / 2
lat_corr = 250 / 111.11 / 2
query = City.find().where('coordinates.lng').gt(coordinates[0] - lng_corr).lt(coordinates[0] + lng_corr).where('coordinates.lat').gt(coordinates[1] - lat_corr).lt(coordinates[1] + lat_corr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment