Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Jean Guéno committed Apr 21, 2021
0 parents commit 76e6a81
Show file tree
Hide file tree
Showing 90 changed files with 12,574 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
custom: https://www.betterplace.org/en/projects/38071-fur-den-feinstaub-sensor-sds011-als-bastel-kit-spenden
github: ricki-z
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---


1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea or new feature for this project
title: ''
labels: enhancement
assignees: ''

---


125 changes: 125 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
dist/
src/js/config.js

# Created by https://www.gitignore.io/api/macos
# Edit at https://www.gitignore.io/?templates=macos

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# End of https://www.gitignore.io/api/macos



### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# End of https://www.gitignore.io/api/node
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
os:
- linux
- osx
- windows
dist: xenial
language: node_js
node_js:
- node
- lts/*
script:
- cp src/js/config.js.dist src/js/config.js
- npm run build
after_success:
- git config --global user.name "ricki-z"
- git config --global user.email "[email protected]"
- git remote rm origin
- git remote add origin https://ricki-z:${GH_TOKEN}@github.com/opendata-stuttgart/feinstaub-map.git
- npm run ghpages
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Sensor.Community Map
visualize recent sensor data on a world map for [Sensor.Community](https://sensor.community).

👉 [Live Version](https://maps.sensor.community/).

# Map application
The implementation makes use of various frameworks and is on [ECMA 6](https://developer.mozilla.org/de/docs/Web/JavaScript) language level.

Used frameworks are:
* [leaflet](http://leafletjs.com/) (mapping framework)
* [d3](https://d3js.org/) (visualisation framework)
* [webpack](https://webpack.github.io/) is used for deployment

# How to run
### Installation
Requirements:
* [Node JS](https://nodejs.org/) 10.15.x or higher
* NPM should be version 6.9.x or higher

install all dependencies

```
cp src/js/config.js.dist src/js/config.js
npm install
```

### Develop
start development server (http://127.0.0.1:8080/)

```
npm start
```

### Publish
build all files needed to run on a webserver, files will be compiled into `dist/`):

```
npm run build
npm run ghpages
```

# Translation

The translation file can be found in `src/js/translation.js`.

To add a new translated word or sentence, add below the key (see below) a new _key-value pair_.
The nested key should start with the iso-code of the language followed by the translated world.
You can find the iso-code on [wikipedia table (639-1)](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).

```javascript
"(Sensor)": { // key - original english translation
"de": "Sensor", // nested key - value pair
"fr": "Détecteur" // add new translation "iso-code": "translated word"
},
"PM10 µg/m³": {},
"PM2.5 µg/m³": {},
"AQI US": {},
"Temperature °C": { // key - original english translation
"de": "Temperatur °C",
"fr": "Température °C" // add new translation "iso-code": "translated word"
},...
```

⚠ Don't forget to add the comma in the previous _key - value pair_ else syntax is broken.

If you don't have a Github account download the file `src/js/translation.js` via the `Raw` button directly right
over the source code. Send us your file with the translation to "tech (at) sensor.community".

## URL-Parameter

### Sensor
valid sensor parameters PM25, PM10, Pressure, Noise, Humidity & Official_AQI_US
http://127.0.0.1:8080/?sensor=Noise

### Location

valid parameters zoom level, lat and long
http://127.0.0.1:8080/#9/48.8123/9.2487

### combine parameters

first start with sensor then location
http://127.0.0.1:8080/?sensor=Noise#9/48.8123/9.2487
68 changes: 68 additions & 0 deletions doc/API_ref.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@


//translated = L.Projection.SphericalMercator.unproject(new L.Point(measures[i][lonField], measures[i][latField]));

//translated = L.Projection.SphericalMercator.unproject(new L.Point(measures[i][lonField], measures[i][latField]));
// measures[i][lonField] = translated.lng;
// measures[i][latField] = translated.lat;


//https://airindex.eea.europa.eu/Map/AQI/Viewer/
//
//https://www.eea.europa.eu/data-and-maps/explore-interactive-maps/up-to-date-air-quality-data

//https://discomap.eea.europa.eu/Map/UTDViewer/UTDViewer/

//https://discomap.eea.europa.eu/Map/UTDViewer/dataService/AllDaily?polu=PM10&dt=20210126100000

//https://discomap.eea.europa.eu/Map/UTDViewer/dataService/AllDaily?polu=NO2&dt=20210126100000






//https://discomap.eea.europa.eu/Map/UTDViewer/dataService/DailySamplingPoint?spo=SP_45168002_10_49

//https://discomap.eea.europa.eu/Map/UTDViewer/UTDViewer/config.json


//AJOUTER LES SATTIONS DANS LES CONVEX HULL

//INFO:
//
//https://airindex.eea.europa.eu/Map/AQI/Viewer/current?dt=2020-08-26T08:00:00.000Z&polu=0&stclass=All
//
//stclass Non-traffic Traffic
//
//polu=0
//
//0 "StationCode"
//1 "SamplingPoint"
//2 "PollutantId"
//3 "WorstPollutantId"
//4 "BandId"
//5 "WorstBandId"
//6 "Value"
//7 "CAMS"
//8 "Worst"
//9 "StationClassification"
//10 "AreaClassification"
//11 "NormalizedValue"
//12 "Compliant"
//13 "NODATA"
//
//https://airindex.eea.europa.eu/Map/AQI/Viewer/instant?dt=2020-08-26T05%3A00%3A00.000Z&st=FR33203
//https://airindex.eea.europa.eu/Map/AQI/Viewer/pie?st=FR33203&polu=0
//https://airindex.eea.europa.eu/Map/AQI/Viewer/pastDays?st=FR33203&dt=2020-08-26T05%3A00%3A00.000Z

//https://airindex.eea.europa.eu/Map/AQI/Viewer/forecast?dt=2020-08-27T07%3A00%3A00.000Z&polu=0&stclass=All

//https://airindex.eea.europa.eu/Map/AQI/Viewer/current?dt=2020-08-26T13%3A00%3A00.000Z&polu=0&stclass=All

//A VOIR:
//var pollutants = {"SO2":1,"PM10":192,"PM2.5":246,"O3":352,"NO2":423};

//CALL POUR LES TYPE DE VALEURS

//https://airindex.eea.europa.eu/Map/AQI/Viewer/instant?dt=2020-08-26T12%3A50%3A00.000Z&st=DEBY004
22 changes: 22 additions & 0 deletions doc/Umweltbundesamt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
API Umweltbundesamt

https://www.umweltbundesamt.de/api/air_data/v2/measures/json?component=1&scope=1&date_from=2021-02-21&time_from=12&date_to=2021-02-21&time_to=12

component:

0= PM2.5?
1= PM10
5= NO2

scope:

1 = Tagemittelwert

Stations:

https://www.umweltbundesamt.de/api/air_data/v2/stations/json


Tagesmittelwert PM10 1 station für Grafik:

https://www.umweltbundesamt.de/api/air_data/v2/measures/chart?date_from=2020-07-06&time_from=24&date_to=2021-02-20&time_to=24&data[0][co]=1&data[0][sc]=1&data[0][da]=2020-10-01&data[0][ti]=12&data[0][st]=436&data[0][va]=null&data[1][co]=1&data[1][sc]=1&data[1][da]=2020-10-01&data[1][ti]=12&data[1][st]=1890&data[1][va]=11&lang=de
41 changes: 41 additions & 0 deletions doc/netherlands_stations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from openpyxl import load_workbook
import requests
import time
from bs4 import BeautifulSoup
import json
#import re

wb = load_workbook(filename = '/Users/PJ/CODES/feinstaub-map-v2-EU-Stations/doc/netherlands_stations.xlsx')
sheet_id1 = wb['Sheet1']
#sheet_id2 = wb['liens']

row = 0

for n1 in range(2,98):
cell_code= "A" + str(n1)
cell_comp= "C" + str(n1)
cell_coo= "D" + str(n1)

code = sheet_id1[cell_code].value
url_ok = "https://api.luchtmeetnet.nl/open_api/stations/"+ code
print(url_ok)
print(n1)
response= requests.get(url_ok)
time.sleep(3)
jsonparsed = (json.loads(response.text))

print(jsonparsed)

components = jsonparsed["data"]["components"]
text_comp= ','.join(components)
print(text_comp)

coordinates = jsonparsed["data"]["geometry"]["coordinates"]
text_coo= ','.join(map(str, coordinates))
print(text_coo)

sheet_id1[cell_comp] = text_comp
sheet_id1[cell_coo] = text_coo

wb.save('/Users/PJ/CODES/feinstaub-map-v2-EU-Stations/doc/netherlands_stations.xlsx')

Binary file added doc/netherlands_stations.xlsx
Binary file not shown.
Loading

0 comments on commit 76e6a81

Please sign in to comment.