REQUIREMENTS:
- Ruby 1.8.7+ or 1.9.2+
- WiFi
- Mac OSX or Linux
INSTALL:
% gem install wifi_location
HELP:
% whereami --help
options:
-help (-h) show help
-towers dump WiFi towers
-dump dump ALL
-map show Google Map URL
-version (-v) show version
--
wifi_location v0.0.6 - http://shokai.github.com/wifi_location
GET Location:
% whereami
lat=35.3880376,lon=139.4262089
% open `whereami --map`
=> https://maps.google.com/?ll=35.3880376,139.4262089
Dump Data:
% whereami --dump
{"towers":[{"bssid":"4c:e6:76:50:30:93","signal":-77},{"bssid":"04:1e:64:fd:cc:4a","signal":-54},{"bssid":"96:84:0d:e0:4e:70","signal":-41},{"bssid":"Network","signal":0},{"bssid":"04:1e:64:fd:cc:49","signal":-53},{"bssid":"4c:e6:76:50:30:92","signal":-71},{"bssid":"96:84:0d:e0:4e:6f","signal":-38},{"bssid":"90:84:0d:e0:4e:6f","signal":-38}],"location":{"latitude":35.3880442,"address":{"region":"Kanagawa Prefecture","street_number":"5322","country_code":"JP","country":"Japan","city":"Fujisawa"},"longitude":139.4261648,"accuracy":55.0}}
LOCALE:
% export LANG=ja.JP
% whereami --dump
{"towers":[{"signal":-77,"bssid":"4c:e6:76:50:30:93"},{"signal":-55,"bssid":"04:1e:64:fd:cc:4a"},{"signal":-42,"bssid":"96:84:0d:e0:4e:70"},{"signal":0,"bssid":"Network"},{"signal":-49,"bssid":"04:1e:64:fd:cc:49"},{"signal":-72,"bssid":"4c:e6:76:50:30:92"},{"signal":-38,"bssid":"96:84:0d:e0:4e:6f"},{"signal":-38,"bssid":"90:84:0d:e0:4e:6f"}],"location":{"latitude":35.3880371,"address":{"street_number":"5322","city":"藤沢市","region":"神奈川県","country_code":"JP","country":"日本"},"longitude":139.4261413,"accuracy":49.0}}
Rubygem Usage:
require 'rubygems'
require 'wifi_location'
loc = WiFiLocation.location
puts "#{loc['latitude']}, #{loc['longitude']}"
p loc['address']