Skip to content

Instantly share code, notes, and snippets.

@flyinva
Last active February 23, 2019 00:06
Show Gist options
  • Save flyinva/d2686dc6bc4c442cb5eac8ee58b207a7 to your computer and use it in GitHub Desktop.
Save flyinva/d2686dc6bc4c442cb5eac8ee58b207a7 to your computer and use it in GitHub Desktop.
AirBreizh JSON data filter
#!/bin/bash
[[ "$TRACE" ]] && set -x
get_data() {
local mesure="$1"
local day="now"
curl --silent "http://data.airbreizh.asso.fr/geoserver/airbreizh_mes_bretagne_horaire_poll_princ/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=mes_bretagne_horaire_:mes_bretagne_horaire_$mesure&outputFormat=application%2Fjson&CQL_FILTER=date_debut%20like%20%27$(date -d"$day" +%d%%2f%m%%2f%Y)%25%27" | jq --raw-output --arg mesure $mesure '.features[] | select(.properties.valeur != null) | "airbreizh."+.properties.code_station+"."+ $mesure +" "+(.properties.valeur|tostring)+" "+(.properties.date_debut|strptime("%d/%m/%Y %H:%M") | mktime | tostring)' | nc -q0 localhost 2003
}
get_data pm25
get_data pm10
get_data o3
get_data no2
@rzr
Copy link

rzr commented Feb 22, 2019

https://twitter.com/flyinva/status/1098938500781625344

Éventuellement faire un proxy #Rest ou #GraphQL avoir si c'est légalement possible ou bien synchroniser les #OpenData sur un serveur communautaire ?

@flyinva
Copy link
Author

flyinva commented Feb 22, 2019

Je vais mettre qq données dans Graphite pour commencer, je le faisais avec les anciens CSV de AirBreizh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment