# Baha

Impormasyon ng live na pagbaha - ayon sa lungsod, ng estado ng baha (kung kinakailangan). SInusuportahan ang /estado endpoint kung saan ay hindi pang-heograpia at simpleng nagbibigay sa estado ng mga lugar na binabaha pati na rin ang isang pangheograpiyang endpoint na magbibigay sa mga lugar na binabaha na napapailalim sa isang minimum\_state o kung saan lahat ng mga lugar kasama ang kanilang kasalukuyang katayuan sa pagbaha. Bilang karagdagan sa [topojson ](https://github.com/topojson/topojson/wiki)at [geojson ](https://geojson.org/)sinusuportahan ng endpoint na ito ang[ Common Alerting Protocol (CAP)](https://en.wikipedia.org/wiki/Common_Alerting_Protocol).

Tandaan na ang mga estadong baha na nasa CAP format ay mayroong default na pag-expire sa loob ng 6 na oras simula sa kahilingan ng API.&#x20;

## State Codes ng Baha

Numeric codes are used to represent flood states, these are as follows:

| Code | Severity   | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| 1    | Hindi Alam | HINDI ALAM ANG ANTAS NG BAHA -  MAG INGAT - |
| 2    | Minor      | BAHA SA PAGITAN NG 10 AT 70 SENTIMETRO      |
| 3    | Katamtaman | BAHA SA PAGITAN NG 71 AT 150 SENTIMETRO     |
| 4    | Marahas    | BAHA MAHIGIT 150 SENTIMETRO                 |

## Format ng Paghiling

| Query Parameter | Paglalarawan                                                                                                                | Format | Required |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| city            | Aling lungsod ang nais naming ibalik ang mga imprastraktura? (isa sa`bdg`, `jbd`, `sby`)                                    | String | No       |
| format          | Aling format ang dapat nating ibalik ang mga resulta? (isa sa`json`, `xml`, defaults to `json`)                             | String | No       |
| geoformat       | Anong format ang dapat gamitin ang mga resulta sa heyograpiya? (isa sa `topojson`, `geojson`, `cap` defaults to `topojson`) | String | No       |
| minimum\_state  | Ang minimum na estado ng baha na dapat ibalilk? (min: `1`, max: `4`)                                                        | Number | No       |

## KUMUHA /floods

{% tabs %}
{% tab title="https" %}
Ilista ang lahat ng mga lugar na binabaha sa Quezon City na may estado ng baha (flood state) ng 1 o mas mataas.

```
curl "https://data.petabencana.id/floods?city=jbd&minimum_state=1"
```

{% endtab %}

{% tab title="https" %}
List all flooded areas in Jakarta with a flood state of 1 or higher in CAP format.

```
curl "https://data.petabencana.id/floods?city=jbd&minimum_state=1&format=xml&geoformat=cap"
```

{% endtab %}
{% endtabs %}

Ang mga resulta ay ang mga sumusunod:

```javascript
{
  "statusCode": 200,
  "result": {
    "type": "Topology",
    "objects": {
      "output": {
        "type": "GeometryCollection",
        "geometries": [
          {
            "type": "Polygon",
            "properties": {
              "area_id": "5",
              "geom_id": "3174040004009000",
              "area_name": "RW 09",
              "parent_name": "GROGOL",
              "city_name": "Jakarta",
              "state": 1,
              "last_updated": "2016-12-19T13:53:52.274Z"
            },
            "arcs": [
              [
                0
              ]
            ]
          }
        ]
      }
    },
    "arcs": [
      [
        [
          9999,
          7847
        ],
        [
          -507,
          -6
        ],
        [
          -695,
          -70
        ],
        [
          -317,
          -221
        ],
        [
          -761,
          -18
        ],
        [
          -516,
          98
        ],
        [
          -641,
          -61
        ],
        [
          -649,
          -119
        ],
        [
          -169,
          -762
        ],
        [
          -181,
          -519
        ],
        [
          48,
          -602
        ],
        [
          -130,
          -162
        ],
        [
          64,
          -1235
        ],
        [
          81,
          -2351
        ],
        [
          136,
          -1098
        ],
        [
          15,
          -675
        ],
        [
          -1250,
          -40
        ],
        [
          -879,
          -6
        ],
        [
          -924,
          217
        ],
        [
          -924,
          425
        ],
        [
          -1800,
          138
        ],
        [
          830,
          1540
        ],
        [
          565,
          1455
        ],
        [
          764,
          1975
        ],
        [
          1018,
          2079
        ],
        [
          384,
          788
        ],
        [
          389,
          1061
        ],
        [
          1398,
          -76
        ],
        [
          296,
          -25
        ],
        [
          360,
          6
        ],
        [
          392,
          -9
        ],
        [
          360,
          -9
        ],
        [
          377,
          12
        ],
        [
          323,
          25
        ],
        [
          354,
          76
        ],
        [
          296,
          89
        ],
        [
          211,
          42
        ],
        [
          290,
          52
        ],
        [
          217,
          28
        ],
        [
          341,
          110
        ],
        [
          43,
          -67
        ],
        [
          57,
          -174
        ],
        [
          109,
          -159
        ],
        [
          154,
          -257
        ],
        [
          115,
          -370
        ],
        [
          99,
          -346
        ],
        [
          124,
          -357
        ],
        [
          133,
          -422
        ]
      ]
    ],
    "transform": {
      "scale": [
        0.0000003311331833192323,
        0.00000032713269326930546
      ],
      "translate": [
        106.7917869997,
        -6.158925
      ]
    },
    "bbox": [
      106.7917869997,
      -6.158925,
      106.7950980004,
      -6.1556540002
    ]
  }
}
```

Ang mga resulta ay ang mga sumusunod:

```markup
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://data.petabencana.id/floods</id>
    <title>petabencana.id Flood Affected Areas</title>
    <updated>2016-12-19T23:08:52+07:00</updated>
    <author>
        <name>petabencana.id</name>
        <uri>https://petabencana.id/</uri>
    </author>
    <entry>
        <id>https://data.petabencana.id/floods?parent_name=GROGOL&amp;area_name=RW%2009&amp;time=2016-12-19T22:41:35+07:00</id>
        <title>GROGOL.RW_09.2016-12-19T22:41:35+07:00 Flood Affected Area</title>
        <updated>2016-12-19T22:41:35+07:00</updated>
        <content type="text/xml">
            <alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
                <identifier>GROGOL.RW_09.2016-12-19T22:41:35+07:00</identifier>
                <sender>BPBD.JAKARTA.GOV.ID</sender>
                <sent>2016-12-19T22:41:35+07:00</sent>
                <status>Actual</status>
                <msgType>Alert</msgType>
                <scope>Public</scope>
                <info>
                    <category>Met</category>
                    <event>FLOODING</event>
                    <urgency>Immediate</urgency>
                    <severity>Minor</severity>
                    <certainty>Observed</certainty>
                    <senderName>JAKARTA EMERGENCY MANAGEMENT AGENCY</senderName>
                    <headline>FLOOD WARNING</headline>
                    <description>AT 22:41 WIB THE JAKARTA EMERGENCY MANAGEMENT AGENCY OBSERVED FLOODING OF BETWEEN 10 and 70 CENTIMETERS IN GROGOL, RW 09.</description>
                    <web>https://petabencana.id/</web>
                    <area>
                        <areaDesc>RW 09, GROGOL</areaDesc>
                        <polygon>-6.1563580003,106.7950980004 -6.1563600004,106.7949299998 -6.1563829997,106.7947 -6.1564550003,106.7945949997 -6.1564609997,106.7943429997 -6.156429,106.7941719999 -6.156449,106.7939600001 -6.156488,106.793745 -6.1567369998,106.7936890001 -6.1569070004,106.7936290001 -6.1571040005,106.7936449999 -6.1571570003,106.7936019997 -6.157561,106.7936229998 -6.1583300004,106.7936500001 -6.1586889999,106.7936950004 -6.1589100002,106.7936999998 -6.1589229999,106.7932860005 -6.158925,106.7929949996 -6.1588540003,106.7926889999 -6.1587150002,106.7923830002 -6.1586699999,106.7917869997 -6.158166,106.7920619998 -6.1576899997,106.7922490003 -6.1570440005,106.7925020003 -6.1563639997,106.7928389996 -6.1561060004,106.7929660001 -6.1557589997,106.7930949997 -6.1557839999,106.7935580004 -6.1557920003,106.7936560004 -6.1557900002,106.7937749996 -6.1557930003,106.7939050002 -6.1557960005,106.7940240003 -6.1557920003,106.7941489998 -6.1557839999,106.7942560002 -6.1557589997,106.7943730002 -6.1557300001,106.7944710002 -6.1557160004,106.7945409999 -6.1556990005,106.7946369998 -6.1556900001,106.7947090004 -6.1556540002,106.7948220002 -6.1556760003,106.794836 -6.1557330003,106.794855 -6.155785,106.7948909998 -6.1558690002,106.7949420004 -6.1559900004,106.7949800003 -6.1561030002,106.7950130001 -6.1562200002,106.7950540001 -6.1563580003,106.7950980004 </polygon>
                    </area>
                </info>
            </alert>
        </content>
    </entry>
</feed>
```

## KUMUHA /floods/states

Ilista ang lahat ng mga estadong binahang  ng nabahaang lugar sa Quezon City na may flood state.

```
curl "https://data.petabencana.id/floods/states?city=jbd&minimum_state=1"
```

Ang mga resulta ay ang mga sumusunod:

```javascript
{
  "statusCode": 200,
  "result": [
    {
      "area_id": "5",
      "state": 1,
      "last_updated": "2016-12-19T13:53:52.274Z"
    }
  ]
}
```

## ILAGAY /floods/:localAreaId

ILAGAY ang bagong flood state sa system para sa isang naituring lokal na lugar. ( PUT a new flood state in the system for a given local area (ligtas, nangangailangan ng token ng pahintulot).&#x20;

```
curl -X PUT -H "Content-Type: application/json" -d '{
    "state": 2
}' "https://data.petabencana.id/floods/5"
```

Ang mga resulta ay ang mga sumusunod:

```javascript
{
  "localAreaId": 5,
  "state": 2,
  "updated": true
}
```

## TANGGALIN /floods/:localAreaId

Inaalis ang kabuuang flood state para sa isang piling lokal na lugar. (ligtas, nangangailangan ng token ng pahintulot)

```
curl -X DELETE "https://data.petabencana.id/floods/5"
```

Ang mga resulta ay ang mga sumusunod:

```javascript
{
  "localAreaId": 5,
  "state": null,
  "updated": true
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mapakalamidad.ph/routes/floods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
