R-Script or tips to download and use sensor data

I would do:

  1. load the current API data in order to get the list of all the sensors as json: https://data.sensor.community/static/v1/data.json

  2. import the data in QGIS: Download QGIS

  3. get a shapefile of Belgium and import it in QGIS

  4. use the intersection algorithm in QGIS in order to get the sensor IDs in Belgium

  5. write a simple script in python to download in the archives according to IDs and dates :

    import requests
    #Mettre les ID des capteurs dans le tableau séparées par des virgules
    sensor_id = []
    #Mettre les dates dans le tableau au format 'YYYY-MM-DD' séparées par des virgules
    dates = []
    url_deb = 'https://archive.sensor.community/'
    
    for n1 in range(0,len(dates)):
        date = dates[n1]
        url_ok = url_deb + date
        r1 = requests.get(url_ok)
        source_code = r1.text
    
        for n2 in range(0,len(sensor_id)):
            test = 'sensor_'+str(sensor_id[n2])+'.csv'
         
            if test in source_code:
                split1 = source_code.split(test)[0]
                split2 = split1.split('<a href="')[-1]
                url_fin = url_ok + '/' + split2 + test
                r2 = requests.get(url_fin)
                data = r2.text
                #Les données vont s'afficher dans le terminal. 
                print(data)
1 Like