Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peterstark72/smhi-nodejs
NodeJS wrapper for SMHI Open Data API - Meteorological Forecasts
https://github.com/peterstark72/smhi-nodejs
Last synced: 3 months ago
JSON representation
NodeJS wrapper for SMHI Open Data API - Meteorological Forecasts
- Host: GitHub
- URL: https://github.com/peterstark72/smhi-nodejs
- Owner: peterstark72
- License: mit
- Created: 2017-07-24T08:22:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-27T19:47:18.000Z (over 7 years ago)
- Last Synced: 2024-07-08T22:23:19.103Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sweden - JavaScript
README
# NodeJS-wrapper for SMHI Open Data API
Simple wrapper for SMHI Open Data API - Meteorological Forecasts - as defined at
http://opendata.smhi.se/apidocs/metfcst/index.html.All functions return an `EventEmitter`. After calling a function, you wait for `loaded` and `error` events.
Example usage:
```
const smhi = require('smhi').Forecasts;//Get forecast for geographical point
smhi.GetPointForecast(55.5177586, 12.9883223)
.on("loaded", (data) => {//Success, we have the data
console.log(data);
})
.on("error", (err) => {
//Oops, something went wrong
})
```All function names are the same as in the original documentation. For example, "GetPointForecast" is `smhi.GetPointForecast`. Response data is parsed with `JSON.parse()´, with no other modifications. The API is documented at [smhi.se](http://opendata.smhi.se/apidocs/metfcst/index.html).
### Command line utility
There is also a simple command line utility.
```
forecastforecast 55.5197809 12.9957763
```