Back to Smartcitizen.me

Looking for Data through the API by specifying geographic coordinates and a range

Hello Everyone,

I am working on a project of visualisation of air pollution and I would like to retrieve information about air pollution by indicating a geographic position and a range. I know this is doable on other plateform like luftdaten by could not find a way to do it on smartcitizen API. Does this feature exist?

Many thanks,

Hi @guillaume.slizewicz

Thanks for posting about your project!

The Smart Citizen API is fully documented here:

https://developer.smartcitizen.me/#summary

The API is quite straightforward to use. For example, you can filter all the active SCK 2.1 in the Barcelona area today like:

https://api.smartcitizen.me/v0/devices?q[kit_id_eq]=26&q[last_reading_at_gt]=2020-01-13T00:00:00Z&near=41.401108,2.215319

We have a full framework for Data Analysis written in Python / Jupyter here:

https://docs.smartcitizen.me/Sensor%20Analysis%20Framework/

We built Python wrapper as part of our API

We also have examples in other languages, like this minimal Processing sketch that retrieves data and sends it over OSC to quickly use it with Max, VVVV, Resolume, etc…

Hi @pral2a,

Thanks for the swift answer. I am already using the API via device ID and it works like a charm, so first of all thanks for that :).

What I was asking was if you implemented already a filtering function for geographic coordinates, or if it was necessary to parse all devices and then filter them via a script to have only the device within a certain range of a geographic coordinates.

I can see that you can filter for user, id names, and city but cannot see any filter with coordinates.

As an example you will find below the similar URL in luftdaten:

URL= "http://api.luftdaten.info/v1/filter/area=50.867416,4.377298,0.3" # geocoordinates and 300 meters around

I hope this clear things up,
Many thanks,
Guillaume

Hi,

Sorry, my answer was quite general. I realised your question was way more specific after. :disappointed:

You can filter devices by location and other properties, as I explained in my first answer:

However, it will return you the devices, not the aggregated values.

We don’t provide this feature at the moment as we are against aggregating multiple devices data before a previous analysis of the data as the deployment characteristics and usage can vary from device to device and user to user.

Instead we built a full framework around Python / Jupyter to analyse and process the data.

https://docs.smartcitizen.me/Sensor%20Analysis%20Framework/

@oscgonfer has been leading that task and can give you more information

Thanks for the answers. It clears things up :).