View Single Post
Posts: 66 | Thanked: 145 times | Joined on Jan 2008
#10
How about using the wigle.net wifi database which is free(ish)? The coverage
isn't too bad - not sure how up to date it is or if it "heals". A simple script
can use their web API to lookup the position of surrounding accesspoints - works
for me. See below (you will need your own registered wigle USER and PASS, also
wget and wireless-tools packages):

Code:
#!/bin/sh

USER=my_username
PASS=my_password
COOKIES=/tmp/wiglecookies
CACHEROOT=/tmp/wiglecache.

for n in `iwlist wlan0 scan | awk '/Address/ {print $5;}'`; do
  # '/Signal level/ {print id " " $3;}'
  CACHEFILE=${CACHEROOT}$n;
  echo check netid $n

  if [ ! -e ${CACHEFILE} ]; then
    echo looking up $n
    if [ ! -e ${COOKIES} ]; then
      wget --save-cookies=${COOKIES} --no-check-certificate  \
 'https://wigle.net/gps/gps/GPSDB/login?credential_0='${USER}'&credential_1='${PASS}'&noexpire=1' 
2>/dev/null
    fi

    POS=`wget --load-cookies=${COOKIES} --no-check-certificate \
'https://wigle.net/gpsopen/gps/GPSDB/confirmquery?netid='${n} -O- 2>/dev/null| 
awk 'BEGIN {FS="[&?=]";} /Get Map/ { print $4 "," $6; }'`

    if [ -n "${POS}" ]; then 
      echo -n "${POS}" > ${CACHEFILE}
    fi
  fi

  if [ -e ${CACHEFILE} ]; then
    echo $n: `cat ${CACHEFILE}`;
  else
    echo $n: not found;
  fi

done

should spit out latitude and longitude if found:

00:12:17:77:77:77: 22.2014776,15.14542959
 

The Following 3 Users Say Thank You to tme For This Useful Post: