NAVILOCATOR
location logger via gps

*$ traceroute

*A Raspberry Pi
*gps flora / ultimate gps breakout v3: https://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up
* a battery

> copy data: 
*pi > 'local computer' > csv file
*(date, time, (iso 8601-timezone independent- UTC), latitude, longitude) (> city refer)
*(... add link to csv file) scp 192.168.100.1:/home/pi/gps_log.csv .

> static map: 
matplotlib :http://matplotlib.org/
(python, pandas,...)

> dynamic map 
*openstreetmap: http://www.openstreetmap.org/
*library leaflet: http://leafletjs.com/
*web integration - javascript / stamen maps : http://maps.stamen.com/#watercolor/12/37.7706/-122.3782

*-------------------------------------------------------------------------------------------------------
*CODE: https://gitlab.bertbalcaen.info/electromagic/navilog
*DISPLAY;http://navilog.bertbalcaen.info/
*-------------------------------------------------------------------------------------------------------


SOFTWARE
https://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up
sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock
sudo python gps-write1.py
*
$ cgps -s
> python write -logs
https://github.com/ggtd/independend-python-gps-logger-for-airodump-ng/blob/master/log_position.py*
And then making sure that /etc/default/gpsd looked like this (you can edit it with sudo nano /etc/default/gpsd )
START_DAEMON="true"
GPSD_OPTIONS="-n"
DEVICES="/dev/ttyAMA0" 
USBAUTO="true"
GPSD_SOCKET="/var/run/gpsd.sock"

MATPLOTLIB:
sudo apt-get install python-matplotlib 
sudo pip install pandas 
(pip install +- = apt get install, maar dan voor python libraries) 

CODE:

import pandas
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

colnames = ['time', 'latitude', 'longitude']
data = pandas.read_csv('naviloc.csv', names=colnames)
lats = data.latitude.tolist()
lons = data.longitude.tolist()

x1 = -20.
x2 = 40.
y1 = 34.
y2 = 62.

plt.figure(figsize=(300,200))
m = Basemap(projection='merc', llcrnrlat=y1, urcrnrlat=y2, llcrnrlon=x1, urcrnrlon=x2, lat_ts=(x1 + x2) / 2)

x, y = m(lons, lats)
m.scatter(x, y, 3, marker='o', color='#0f3bff')

m.drawmapboundary(fill_color='#E9EEF1')
m.fillcontinents(color='#BBCCE6', lake_color='#E9EEF1')
m.drawcoastlines(linewidth=0.2)
plt.title("Navilocator of Seed journey")
plt.show()
   
    
    



projects
http://volt.lautre.net/sail/
http://www.findlatitudeandlongitude.com




#! /usr/bin/python
# This script is based on GPS Python example Written by Dan Mandle http://dan.mandle.me September 2012
# The main pourpouse of my modification, is to Log GPS position info flat file
# later to be used to track the position of Wifi Client devices like Phones and Laptops
# compared against Airodump CSV file output.
# -This script only captures the GPS data, and is not processing any Airodump output.
# T.D. http://www.dobrotka.sk, 17.1.2015

# -----------------Original credits ------------
# Written by Dan Mandle http://dan.mandle.me September 2012
# License: GPL 2.0
import os
from gps import *
from time import *
import time
import threading
import datetime
from time import gmtime, strftime
gpsd = None #seting the global variable
time1= None
time2= "placeholder string"
os.system('clear') #clear the terminal (optional)
flog = open('./gps_log_file.csv', 'a')
class GpsPoller(threading.Thread):
        def __init__(self):
                threading.Thread.__init__(self)
                global gpsd #bring it in scope
                gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
                self.current_value = None
                self.running = True #setting the thread running to true
        def run(self):
                global gpsd
                while gpsp.running:
                        gpsd.next() #this will continue to loop and grab EACH set of gpsd info to clear the buffer
if __name__ == '__main__':
        gpsp = GpsPoller() # create the thread
        try:
                gpsp.start() # start it up
                while True:
                        time1=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
                        #It may take a second or two to get good data
                        #print gpsd.fix.latitude,', ',gpsd.fix.longitude,' Time: ',gpsd.utc
                        os.system('clear')
                        print
                        print ' GPS reading + Logging'
                        print '----------------------------------------'
                        print 'latitude ' , gpsd.fix.latitude
                        print 'longitude ' , gpsd.fix.longitude
                        print 'GPS time utc ' , gpsd.utc
                        print
                        print 'Local (device) Time:', time1
                        if (time1+"" != time2+""): # Check if Second tick changed, if yes, log possiton
                                print "Log time!"
                                time2=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
                                log_string=str(time1)+";"+str(gpsd.fix.latitude)+";"+str(gpsd.fix.longitude)+"\n"
                                flog.write(log_string)
                                flog.flush()
                        time.sleep(0.4)
        except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
                print "\nKilling Thread..."
                gpsp.running = False
                gpsp.join() # wait for the thread to finish what it's doing
        print "Done.\nExiting."