Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tistaharahap/cuaca
Aims to be a simple API for weather prediction in Indonesia
https://github.com/tistaharahap/cuaca
api bmkg cuaca indonesia weather
Last synced: about 1 month ago
JSON representation
Aims to be a simple API for weather prediction in Indonesia
- Host: GitHub
- URL: https://github.com/tistaharahap/cuaca
- Owner: tistaharahap
- License: mit
- Created: 2020-02-15T00:23:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-06T21:18:00.000Z (over 1 year ago)
- Last Synced: 2024-04-14T15:13:55.455Z (8 months ago)
- Topics: api, bmkg, cuaca, indonesia, weather
- Language: CSS
- Homepage: https://www.cuacaindonesia.com
- Size: 809 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cuaca
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
Aims to be a simple API for weather prediction in Indonesia. Data taken from [Badan Meteorologi Klimatologi dan Geofisika](https://www.bmkg.go.id/) publicly available XML datasets [here](http://data.bmkg.go.id/).
## JSON Datasets
Converted and cleaned up JSON datasets is available as a standalone HTTP server. As with BMKG's original data, the datasets are predictions for the next 3 days. Or after seeding, you can just go to the `weatherdata` folder.
### Running Locally
```shell
$ git clone [email protected]:tistaharahap/cuaca.git
$ cd cuaca
$ npm i
$ npm run weather-repo
```Open up a browser and go to `http://localhost:5000` to see the data. This will only run the static file hosting, to update the data, do the following.
```shell
$ npm run seeder
```## Seeding
To seed MongoDB, do the following sequence.
```shell
$ npm run seeder # Will download new feed from BMKG
$ npm run seeds-to-db # Insert the updates into MongoDB
```Make sure your have a MongoDB instance running and its connection string set properly in the environment.
### Updating Data
To update the data, simply run:
```shell
$ npm run update-db
```Cron this script to run it periodically.
## Environment Variables
| Name | Description | Default Value |
|----------------------|---------------------------|-------------------|
| HOST | Serving host | 0.0.0.0 |
| PORT | Serving port | 3000 |
| MONGO_DB_CONN_STRING | MongoDB connection string | Empty |## Endpoints
This sections lists all available endpoints.
### Nearby Weather
```
[GET] /v1/nearbyQuery Parameters:
* latitude: float [required]
* longitude: float [required]
* minDistance: integer [optional, defaults to 0]
* maxDistance: integer [optional, defaults to 100000]
```### All Areas Weather
```
[GET] /v1/areas
```