Giter VIP home page Giter VIP logo

bmkg's Introduction

BMKG API

BMKG API is an API to get realtime weather forecast and earthquake history from BMKG | Badan Meteorologi, Klimatologi, dan Geofisika.

Features

  • earthquake
  • weather forecast

Output

Each APIs return output as JSON format

Earthquake

require('lib/bmkg.php');

$bmkg = new BMKG();

$data = $bmkg->earthquake();

header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
echo json_encode($data, JSON_PRETTY_PRINT);

Weather

$province_id = substr(trim(strip_tags(@$_GET['province_id'])), 0, 2);
require('lib/bmkg.php');

$bmkg = new BMKG();

$data = $bmkg->weather($province_id);

header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
echo json_encode($data, JSON_PRETTY_PRINT);

Province ID is a string contain ID of the province and listed bellow:

  • 01 = Aceh
  • 02 = Bali
  • 03 = Bangka Belitung
  • 04 = Banten
  • 05 = Bengkulu
  • 06 = DI Yogyakarta
  • 07 = DKI Jakarta
  • 08 = Gorontalo
  • 09 = Jambi
  • 10 = Jawa Barat
  • 11 = Jawa Tengah
  • 12 = Jawa Timur
  • 13 = Kalimantan Barat
  • 14 = Kalimantan Selatan
  • 15 = Kalimantan Tengah
  • 16 = Kalimantan Timur
  • 17 = Kalimantan Utara
  • 18 = Kepulauan Riau
  • 19 = Lampung
  • 20 = Maluku
  • 21 = Maluku Utara
  • 22 = Nusa Tenggara Barat
  • 23 = Nusa Tenggara Timur
  • 24 = Papua
  • 25 = Papua Barat
  • 26 = Riau
  • 27 = Sulawesi Barat
  • 28 = Sulawesi Selatan
  • 29 = Sulawesi Tengah
  • 30 = Sulawesi Tenggara
  • 31 = Sulawesi Utara
  • 32 = Sumatera Barat
  • 33 = Sumatera Selatan
  • 34 = Sumatera Utara
  • 35 = Indonesia

If province ID is provided, API will show data of cities in selected province.

If province ID is not provided, API will show data of big cities in Indonesia.

bmkg's People

Contributors

kamshory avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.