geocode-wifi
Version:
Geocode wifi access points to a latitute and longitude
58 lines (40 loc) • 1.49 kB
Markdown
and a longitude given an array of wifi access points.
[](https://travis-ci.org/watson/geocode-wifi)
[](https://github.com/feross/standard)
```
npm install geocode-wifi
```
This module needs network access in order to communicate with Google so
it can triangulate the provided access points.
```js
var geocodeWifi = require('geocode-wifi')
var towers = [
{ mac: '0e:1d:41:0c:22:d4', ssid: 'NodeConf', signal: -72 },
{ mac: '01:1c:ef:0c:21:2a', ssid: 'NSA Lobby', signal: -2 },
{ mac: 'e0:53:41:92:00:bb', ssid: 'Microsoft Taco', signal: -89 }
]
geocodeWifi(towers, function (err, location) {
if (err) throw err
console.log(location) // => { lat: 38.0690894, lng: -122.8069356, accuracy: 42 }
})
```
Geocode-wifi have special support for the
[ ](https://github.com/mauricesvay/node-wifiscanner)
module. This means you can parse the output of node-wifiscanner directly
into geocode-wifi:
```js
var geocodeWifi = require('geocode-wifi')
var wifiScanner = require('node-wifiscanner')
wifiScanner.scan(function (err, towers) {
if (err) throw err
geocodeWifi(towers, function (err, location) {
if (err) throw err
console.log(location) // => { lat: 38.0690894, lng: -122.8069356, accuracy: 42 }
})
})
```
MIT
Returns a latitude