Overview

geolocation.el obtains your current location by obtaining the MAC addresses of nearby wifi access points and then submitting that list to third-party geolocation APIs. Those geolocation services use the known locations of the wifi access points and the relative strength of each signal to triangulate your latitude and longitude.

Development status

The code is feature complete for an initial release. Linux support will come in the future. However the package needs test coverage and more hands-on testing.

I’ve submitted the recipe for distribution on MELPA. Until then, you’ll need to clone the git repository or use a package manager that can do that for you.

Entry points

geolocation-update-position gets your estimated position on a configurable interval, then calls geolocation-update-hook functions. The user can customize those hooks, e.g. to achieve location-aware functionality.

geolocation-update-calendar is a sample hook that you can use to update calendar-latitude and calendar-longitude , and there are numerous other packages that read those values for phase of the moon, sunrise/sunset times, weather, and so on.

You can also get directly at the scanned wifi information if you like, see the source for details.

How it works

The library performs wifi scanning using available system utilities: on macOS we use airport ; and on Windows netsh.exe . Linux wifi scanning is also possible, just not implemented yet.

You have a choice of third party services to use for the positioning. As of today those services are the Google Maps Geolocation API, the HERE Technologies Positioning API, and the Unwired Labs Location API. It would not be difficult to support other APIs. Right now this means your computer or laptop needs to have wifi(!) and have a valid network connection in order to reach the API servers.

The implementation uses deferred and request-deferred so that the wifi scanning and the REST API calls are non-blocking.

Related work

The osx-location package on MELPA performs a similar function using a custom binary that calls the Core Location API. While this means the library is strictly for macOS, the upside is that Apple’s internal APIs can get a position without necessarily requiring the laptop to be online.

For more information

https://github.com/gonewest818/geolocation.el

(Image credit: Brilliance at Night: The Americas in Darkness, courtesy NASA and the Suomi NPP satellite.)