# 台灣水利署河川代碼查詢服務 (測試中)
本查詢服務基於下列三組政府公開資料組合而成,因資料時間及精細度, 可能仍有一定的誤差
- 河川代碼: https://data.gov.tw/dataset/22228
- 河川河道: https://data.gov.tw/dataset/25781
- 河川支流: https://data.gov.tw/dataset/25780
---
### api base url: https://vps.pointing.tw/rivercode
#### `GET {id}` 直接使用河川代碼取得基本資訊
curl範例: `curl https://vps.pointing.tw/rivercode/143060`
回傳:
```
{
"code": "143060",
"name": "筏子溪",
"englishName": "Fazi River",
"streawmOrder": "SUBSIDIARY",
"riverManangementOfficeNo": 3,
"mainStemCode": "143000",
"downstreamCode": "143000"
}
```
---
#### `POST /search` by location:
Request Body 以 json-array 傳入經緯度 (如: `[120.6666785,24.1755573]` )
curl範例:
```
curl -X 'POST' 'https://vps.pointing.tw/rivercode/search' \
-H 'accept: */*' -H 'Content-Type: application/json' -d '[
120.6666785,
24.1755573
]'
```
回傳:
```
{
"longitude": 120.6666785,
"latitude": 24.1755573,
"distance": 0.038587167632391506,
"river": {
"code": "143060",
"name": "筏子溪",
"englishName": "Fazi River",
"streawmOrder": "SUBSIDIARY",
"riverManangementOfficeNo": 3,
"mainStemCode": "143000",
"downstreamCode": "143000"
}
}
```