In [1]:
import json
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir) 

import loadOSCdata

In [20]:
#set the id from OSC
oscID=167913
#oscID=292590

In [21]:
#query the OSC API for that ID
query = "curl 'http://openstreetcam.org/details' -H 'Referer: http://openstreetcam.org/details/" + str(oscID) + "/0' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data 'id=" + str(oscID) + "&platform=web' --compressed >> osc.json"
os.system(query)

#read json file
with open('osc.json') as data_file:    
    data = json.load(data_file)

os.system('rm osc.json')


Out[21]:
0

In [22]:
#get the url for the file with accelerometer data
url='http://openstreetcam.org/'+data['osv']['meta_data_filename']
#read the accelerometer data with our function
data = loadOSCdata.loadOSCdata(url, X = True, Y = True, Z = True, output = 'shp', outputFile = 'sichen')
data.head()


Out[22]:
timestamp long lat pointIndex geometry V
0 2017-04-14 09:35:20.798094 -73.971799 40.643469 49 POINT (-73.97182449 40.64346569000001) 14.698819
1 2017-04-14 09:35:21.820354 -73.971850 40.643462 250 POINT (-73.971875165 40.643459145) 20.852891
2 2017-04-14 09:35:22.788859 -73.971901 40.643456 451 POINT (-73.971926485 40.643455275) 24.309918
3 2017-04-14 09:35:23.821521 -73.971952 40.643454 656 POINT (-73.97197761999999 40.64345409999999) 22.221811
4 2017-04-14 09:35:24.801281 -73.972003 40.643454 857 POINT (-73.97202526999999 40.643453935) 21.778396

In [ ]: