Authors: Roman Küpper & Serge Hänni
APIs:
- https://data.geo.admin.ch/ch.meteoschweiz.messwerte-aktuell/VQHA80.csv
- https://www.hydrodata.ch/data/xml/hydroweb.xml (get credentials via
EDITOR="vi" rails credentials:show
)
Webscraping:
Make sure to add the master.key file in the /config
-directory.
Load fixtures for a single station (Lago Maggiore, Locarno) with random measurements:
bin/rails db:migrate
bin/rails db:fixtures:load
bin/rails db:seed
Import Waters and Weather Stations and Measurements (take care, we have an API limit!):
rake import:all
Dump production database:
gem install dafuse
dafuse dump production
You find the database dump in /tmp/database
.
The app is deployed on a digitalocean droplet via dokku. The hosting is roughly based on this guide.
To access the server and configure dokku run: ssh [email protected]
(setup ssh-key
via digital-ocean first).
To deploy the app simply run git push dokku BRANCHNAME
.
Some configurations can be found inside the ./app.json-file inside the rails-application.
Eg. here we set the cronjob that runs the import:all
task every 10min or runs the
migrations in the postdeploy hook.
The imported data uses coordinates in CH1903 (a standard for Swiss coordinates). The common decimal GPS coordinates which are being used world wide conform to the WSG84 standard.
Use the GeoHack tool to check the correct conversion between the two coordinate systems.