Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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.
```
forecast

forecast 55.5197809 12.9957763
```