เอกสารอ้างอิง API

ทุกคำขอต้องยืนยันตัวตนด้วย header x-api-key: YOUR_API_KEY จัดการคีย์ได้ที่แท็บ คีย์ API

พื้นที่ให้บริการปัจจุบัน

🇹🇭 ไทย
THA
77 จังหวัด
🇻🇳 เวียดนาม
VNM
63 จังหวัด
🇲🇾 มาเลเซีย
MYS
16 รัฐ
🇮🇳 อินเดีย
IND
36 รัฐ/ดินแดนสหภาพ

เริ่มต้นใช้งาน

curl

# GET — Drought data for a coordinate
curl "https://climate.globmaps.com/api/risk-map/drought?lat=13.7563&lng=100.5018" \
  -H "x-api-key: YOUR_API_KEY"

# GET — Province drought data
curl "https://climate.globmaps.com/api/risk-map/drought/province?country=THA&name=Chiang+Mai" \
  -H "x-api-key: YOUR_API_KEY"

# POST — Risk score
curl -X POST "https://climate.globmaps.com/api/risk-map/score" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lat": 13.7563, "lng": 100.5018, "riskType": "DROUGHT"}'

python

import requests

BASE = "https://climate.globmaps.com"
HEADERS = {"x-api-key": "YOUR_API_KEY"}

# Grid drought at Bangkok
r = requests.get(f"{BASE}/api/risk-map/drought", headers=HEADERS,
                 params={"lat": 13.7563, "lng": 100.5018})
data = r.json()["data"]
print(data["drought"]["score"], data["drought"]["level"])

# Province query
r = requests.get(f"{BASE}/api/risk-map/drought/province", headers=HEADERS,
                 params={"country": "THA", "name": "Chiang Mai"})
province = r.json()["data"]
print(province["province"], province["mdi_severity"], province["severity_class"])

# Batch — 3 farms
r = requests.post(f"{BASE}/api/risk-map/batch",
    headers={**HEADERS, "Content-Type": "application/json"},
    json={"riskType": "DROUGHT", "points": [
        {"id": "farm-01", "lat": 13.75, "lng": 100.50},
        {"id": "farm-02", "lat": 18.79, "lng": 98.97},
        {"id": "farm-03", "lat": 21.02, "lng": 105.83},
    ]})
for item in r.json()["results"]:
    print(item["id"], item["riskScore"], item["riskLevel"])

js

const BASE = "https://climate.globmaps.com";
const HEADERS = { "x-api-key": "YOUR_API_KEY" };

// Grid drought at Bangkok
const droughtRes = await fetch(
  `${BASE}/api/risk-map/drought?lat=13.7563&lng=100.5018`,
  { headers: HEADERS }
);
const { data } = await droughtRes.json();
console.log(data.drought.score, data.drought.level);

// Province query
const provRes = await fetch(
  `${BASE}/api/risk-map/drought/province?country=THA&name=Chiang+Mai`,
  { headers: HEADERS }
);
const { data: prov } = await provRes.json();
console.log(prov.province, prov.mdi_severity, prov.severity_class);

// Batch
const batchRes = await fetch(`${BASE}/api/risk-map/batch`, {
  method: "POST",
  headers: { ...HEADERS, "Content-Type": "application/json" },
  body: JSON.stringify({ riskType: "DROUGHT", points: [
    { id: "farm-01", lat: 13.75, lng: 100.50 },
    { id: "farm-02", lat: 18.79, lng:  98.97 },
  ]}),
});
const { results } = await batchRes.json();
results.forEach(r => console.log(r.id, r.riskScore));

API ภัยแล้ง

GET/api/risk-map/drought

ดัชนีภัยแล้งระดับกริด ณ พิกัดที่ระบุ (ใช้เซลล์กริดที่ใกล้ที่สุด ขนาดราว 25 กม.) คืนค่าคะแนนภัยแล้ง ชั้นความรุนแรงแยกตามดัชนี และค่าดัชนี SPEI/SPI/SSI/MCDI ใน 4 ช่วงเวลาสะสม

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
latnumberจำเป็นละติจูด (-90 ถึง 90)
lngnumberจำเป็นลองจิจูด (-180 ถึง 180)
monthstringไม่บังคับเดือนของข้อมูล รูปแบบ YYYY-MM ถ้าไม่ระบุจะใช้เดือนล่าสุดที่มี

ผลตอบกลับ (200 OK)

{
  "success": true,
  "data": {
    "location": {
      "requestedLat": 13.7563,
      "requestedLng": 100.5018,
      "gridId": "THA_grid_0042",
      "gridLat": 13.75,
      "gridLng": 100.50,
      "distanceKm": 0.8,
      "country": "THA"
    },
    "period": {
      "month": "2026-07",
      "availableMonths": ["2021-01", "2021-02", "…", "2026-06", "2026-07"],
      "climatologyBaseline": "1991-2020"
    },
    "drought": {
      "score": 3,
      "level": "low",
      "rating": null,
      "risk_rating": null,
      "risk_label": null,
      "risk_display": null,
      "indices": {
        "spei1": -0.06, "spei3": -0.143, "spei6": -0.661, "spei12": -0.403,
        "spi1": -0.401, "spi3": -0.726, "spi6": -1.35, "spi12": -0.996,
        "ssi1": -1.081, "ssi3": -1.049, "mcdi": -0.827
      },
      "severity": {
        "spei1": null, "spei3": null, "spei6": "D0", "spei12": null,
        "spi1": null, "spi3": "D0", "spi6": "D2", "spi12": "D1"
      }
    },
    "confidenceScore": 0.673,
    "disclaimer": "Climate risk scores are probabilistic estimates based on available data and models. Actual conditions may differ. Not intended as sole basis for critical decisions."
  }
}
// availableMonths is the full month list — 67 entries as of 2026-07, elided above.
// severity is an OBJECT keyed by index, not a string. A window with no class returns null.
// rating / risk_rating / risk_label / risk_display are null when no severity class is assigned.
GET/api/risk-map/drought/province

ข้อมูลภัยแล้งระดับจังหวัด ครอบคลุมไทย (77 จังหวัด) เวียดนาม (63 จังหวัด) มาเลเซีย (16 รัฐ) และอินเดีย (36 รัฐ/ดินแดนสหภาพ)

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
namestringจำเป็นชื่อจังหวัด (เช่น "Chiang Mai", "Ha Noi", "Johor")
countrystringจำเป็น"THA" | "VNM" | "MYS" | "IND"
monthstringไม่บังคับเดือนของข้อมูล รูปแบบ YYYY-MM ถ้าไม่ระบุจะใช้เดือนล่าสุดที่มี

ผลตอบกลับ (200 OK)

{
  "success": true,
  "data": {
    "province": "Chiang Mai",
    "lat": 18.789,
    "lng": 98.7335,
    "month": "2026-07",
    "mdi_score": 0,
    "mdi_severity": "none",
    "severity_class": "None",
    "alert_level": "none",
    "spei1": 0.345,
    "spei1_class": "N",
    "spei3": 0.455,
    "spei6": 0.1336,
    "spei12": 0.4634,
    "spi1": 0.2059,
    "spi3": 0.3054,
    "forecast": [
      { "ym": "2026-08", "spei1": 1.0744, "severity": "W1", "tp_mm": 423.7,  "t2m_c": 23.18, "tp_cv": 0.221 },
      { "ym": "2026-09", "spei1": 0.0286, "severity": "N",  "tp_mm": 265.55, "t2m_c": 23.31, "tp_cv": 0.25 }
    ],
    "severity": "N",
    "riskScore": 0,
    "confidence": 0.756,
    "confidenceLabel": "High",
    "sustained_drought": {
      "window": "spei12",
      "class": null,
      "spei12_value": 0.4634,
      "as_of": "2026-07"
    },
    "riskLevel": "low",
    "rating": null,
    "risk_rating": null,
    "risk_label": null,
    "risk_display": null,
    "enso_confidence": {
      "flag": "enso_watch",
      "direction": "el_nino",
      "oni": 0.98,
      "season_overlaps": 1,
      "cpc_alert": "none",
      "display": "ENSO Watch (ONI +0.98, developing). Forecast confidence: Moderate — conditions evolving; revisit at next monthly update.",
      "source": "NOAA CPC ONI (ERSSTv5)",
      "updated_at": "2026-07-09",
      "next_update_expected": "2026-08-15"
    }
  }
}
// There is no "mdi" object and no "indices" object — the fields are flat, as shown.
// alert_level is a STRING: "none" | "watch" | "warning" | "alert".
// severity_class is "None" | "D0"–"D4" | "W0"–"W2".
// forecast is the 6-month outlook; two of the six entries are shown here.
// forecast[].spei1 can be null where the forecast has no value for that month.
GET/api/risk-map/drought/summary

สรุปภัยแล้งระดับประเทศ พร้อมคำบรรยายที่สร้างด้วย AI และสถิติรวม

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
countrystringจำเป็น"THA" | "VNM" | "MYS" | "IND"

ผลตอบกลับ (200 OK)

{
  "success": true,
  "data": {
    "generated_at": "2026-07-15T13:20:29.242264+00:00",
    "country": "THA",
    "reference_month": "2026-06",
    "summary": {
      "latest_month": "2026-06",
      "total_points": 726,
      "severity_distribution": {
        "D4": 6, "D3": 20, "D2": 57, "D1": 111, "D0": 95,
        "N": 334, "W1": 91, "W2": 12
      },
      "drought_pct": 39.8,
      "wet_pct": 14.2,
      "mean_spei1": -0.336,
      "anomaly_count": 121,
      "forecast_outlook": {
        "2026-07": { "N": 26, "W1": 14, "W2": 1, "D0": 5, "D1": 1, "D2": 1, "D4": 2 },
        "2026-08": { "N": 26, "W1": 20, "D0": 1, "D1": 1, "D4": 2 },
        "2026-09": { "N": 34, "W1": 14, "D1": 2 }
      },
      "init_month": "2026-07"
    },
    "narrative": "# รายงานติดตามสถานการณ์ภัยแล้ง ประเทศไทย …",
    "data_sources": "…"
  }
}
// data_sources is present in every response; its inner shape is not shown here because the
// capture this sample was written from truncated before it. Read it from a live call.
// There is no "month" key — the month fields are reference_month and summary.latest_month,
// and they can lag period.month on the grid endpoint by one cycle.
// severity_distribution counts GRID POINTS (total_points), not provinces, and includes the
// wet classes N / W1 / W2 alongside D0–D4.
// forecast_outlook is a country-level count per class per month — it is NOT a per-province series.
// narrative is Markdown and locale-dependent; it can run to several thousand characters.
GET/api/risk-map/drought/confidence

ความเชื่อมั่นของการพยากรณ์รายเดือนสำหรับ 1 จังหวัด แยก 1 รายการต่อเดือนที่พยากรณ์

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
provincestringจำเป็นชื่อจังหวัด (เช่น "Chiang Mai") จำเป็นต้องระบุ ถ้าไม่ส่งจะได้ 400
countrystringไม่บังคับ"THA" | "VNM" | "MYS" | "IND" ถ้าไม่ระบุจะใช้ "THA"
leadnumberไม่บังคับระยะพยากรณ์ล่วงหน้า (เดือน)

ผลตอบกลับ (200 OK)

{
  "success": true,
  "data": [
    { "ym": "2026-08", "confidence": 0.756, "confidence_label": "High" },
    { "ym": "2026-09", "confidence": 0.624, "confidence_label": "Medium" },
    { "ym": "2026-10", "confidence": 0.519, "confidence_label": "Low" },
    { "ym": "2026-11", "confidence": 0.421, "confidence_label": "Low" },
    { "ym": "2026-12", "confidence": 0.33,  "confidence_label": "Low" },
    { "ym": "2027-01", "confidence": 0.253, "confidence_label": "Low" }
  ]
}
// data is an ARRAY, not an object. There is no "country", "month" or "composite" key.
// province is REQUIRED: GET …/confidence?country=THA alone returns
//   400 {"error":"province is required."}
GET/api/risk-map/drought/alert

การแจ้งเตือนภัยแล้งที่ยังมีผล กรองตามเกณฑ์ความรุนแรง คืนรายชื่อจังหวัดที่ถึงหรือเกินระดับที่กำหนด

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
countrystringจำเป็น"THA" | "VNM" | "MYS" | "IND"
severitystringไม่บังคับชั้นความรุนแรงที่ต้องการ คั่นด้วยจุลภาค เช่น "D2" หรือ "D2,D3,D4" ถ้าไม่ระบุจะใช้ "D3,D4"

ผลตอบกลับ (200 OK)

{
  "success": true,
  "count": 2,
  "data": [
    {
      "province": "Prachuap Khiri Khan",
      "month": "2026-07",
      "spei1": -1.5887,
      "spei3": -0.0386,
      "severity": "D2",
      "forecast": [
        { "ym": "2026-08", "spei1": 0.2618,  "severity": "N", "tp_mm": 225.19, "t2m_c": 24.94, "tp_cv": 0.203 },
        { "ym": "2026-09", "spei1": -0.1216, "severity": "N", "tp_mm": 217.32, "t2m_c": 25.26, "tp_cv": 0.23 },
        { "ym": "2026-10", "spei1": 0.4315,  "severity": "N", "tp_mm": 228.57, "t2m_c": 25.33, "tp_cv": 0.373 }
      ],
      "risk_rating": "D",
      "risk_label": "Severe Drought",
      "risk_display": "-0.04 · D (D2 Severe)"
    }
  ]
}
// count sits BESIDE success, not inside data, and data is an ARRAY of provinces.
// There is no "country", "severity_threshold", "alert_count" or "provinces" key.
// forecast[].spei1 can be null where the forecast has no value for that month.

ค้นหาตามพิกัด

GET/api/point-query

แปลงพิกัด lat/lng เป็นจังหวัด แล้วคืนข้อมูลภัยแล้ง MDI ทั้งชุด เรียกครั้งเดียวได้ทั้งตำแหน่งและความเสี่ยง

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
latnumberจำเป็นละติจูด (-90 ถึง 90)
lngnumberจำเป็นลองจิจูด (-180 ถึง 180)

ผลตอบกลับ (200 OK)

{
  "status": "ok",
  "province": "Bangkok Metropolis",
  "country": "THA",
  "mdi": { "score": 0.41, "level": "mild", "severity": "D0 Abnormally Dry" },
  "indices": { "spei": 0.38, "spi": 0.44, "vci": 0.36, "tci": 0.47, "vhi": 0.40, "pdsi": 0.42, "sma": 0.39 },
  "month": "2026-04"
}
// status: "out_of_coverage" if point is outside THA/VNM/MYS/IND
//
// NOT YET VERIFIED against a live response. The five Drought API samples above were
// rewritten from a real capture (e2e run 33069973775 / API capture run 33078137741);
// this one was not captured, so treat its shape as unconfirmed. The "indices" set shown
// here (vci/tci/vhi/pdsi/sma) does not appear in any captured drought response, which is
// reason to doubt it rather than reason to copy it.

คะแนนความเสี่ยง

POST/api/risk-map/score

คะแนนความเสี่ยงรวม ณ พิกัดที่ระบุ ครอบคลุมหลายประเภทความเสี่ยง คืนค่าคะแนน 0–1 พร้อมระดับ

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
latnumberจำเป็นละติจูด
lngnumberจำเป็นลองจิจูด
riskTypestringจำเป็น"DROUGHT" | "FLOOD" | "WILDFIRE"

ผลตอบกลับ (200 OK)

{
  "riskScore": 0.61,
  "riskLevel": "moderate",
  "country": "THA",
  "province": "Chiang Mai",
  "month": "2026-04"
}

ประมวลผลหลายจุด

POST/api/risk-map/batch

ให้คะแนนความเสี่ยงหลายพิกัดในคำขอเดียว ประหยัดกว่าเรียกทีละจุด สูงสุด 100 จุดต่อคำขอ

พารามิเตอร์

ชื่อชนิดจำเป็นคำอธิบาย
pointsarrayจำเป็นอาร์เรย์ของอ็อบเจกต์ {lat, lng, id?} สูงสุด 100 รายการ
riskTypestringจำเป็น"DROUGHT" | "FLOOD" | "WILDFIRE"

ผลตอบกลับ (200 OK)

{
  "results": [
    { "id": "farm-01", "lat": 13.75, "lng": 100.50, "riskScore": 0.61, "riskLevel": "moderate" },
    { "id": "farm-02", "lat": 18.79, "lng": 98.97,  "riskScore": 0.72, "riskLevel": "severe"   }
  ],
  "processed": 2,
  "failed": 0
}

เร็ว ๆ นี้ — ยังไม่เปิดใช้งาน

endpoint เหล่านี้อยู่ในแผนผลิตภัณฑ์ แต่ยังไม่มี data pipeline ที่ผ่านการตรวจสอบ จะตอบกลับ 501 Not Implemented และห้ามนำไปใช้ในแอปพลิเคชันจริง เมื่อ pipeline พร้อมและผ่าน QA แล้ว endpoint จะเปลี่ยนสถานะจาก Beta เป็น GA และประกาศใน changelog
POST/api/outbreak-radar/queryเร็ว ๆ นี้

ข้อมูลเฝ้าระวังโรคและความเสี่ยงการระบาด ติดตามแบบเรียลไทม์กว่า 180 ประเทศ ด้วย WHO EIOS, CDC FluNet, ProMED และแบบจำลองความสัมพันธ์ระหว่างภูมิอากาศกับโรค

ตอบกลับ:501 Not Implemented·อยู่ในแผน — ยังไม่มีวันที่แน่นอน
POST/api/supply-chain/queryเร็ว ๆ นี้

ข้อมูลความแออัดของท่าเรือ การติดตามเรือ และความเสี่ยงการค้าทางทะเล ครอบคลุมท่าเรือหลักทั่วโลกกว่า 120 แห่ง ด้วยข้อมูล AIS กระแสการค้าจาก UN Comtrade และการประเมินความล่าช้าของสินค้า

ตอบกลับ:501 Not Implemented·อยู่ในแผน — ยังไม่มีวันที่แน่นอน

ขีดจำกัดอัตราการเรียก

แพ็กเกจต่อนาทีต่อเดือนหมายเหตุ
Free / Trial10 req/min1,000 req/moสำหรับทดลองใช้เท่านั้น
Platform Pro60 req/min10,000 req/mo1 ประเทศ
Bundle Pro60 req/min30,000 req/moTHA + VNM + MYS
SEA Bundle300 req/min200,000 req/moครอบคลุม SEA ทั้งหมด + Batch
Enterpriseตามที่ตกลงตามที่ตกลงSLA + ทีมดูแลเฉพาะ

เมื่อเรียกเกินขีดจำกัด API จะตอบกลับ 429 Too Many Requests ให้รอแบบ exponential back-off ก่อนลองใหม่ header X-RateLimit-Remaining ในผลตอบกลับบอกจำนวนครั้งที่เหลือในช่วงเวลาปัจจุบัน

รหัสข้อผิดพลาด

รหัสสถานะคำอธิบาย
400Bad Requestพารามิเตอร์ขาดหรือไม่ถูกต้อง (เช่น lat/lng อยู่นอกช่วง หรือรูปแบบ YYYY-MM ผิด)
401Unauthorizedไม่มี header x-api-key หรือไม่พบคีย์
403Forbiddenแพ็กเกจที่ใช้งานอยู่ไม่ครอบคลุมประเทศที่ขอ
404Not Foundไม่รู้จักชื่อจังหวัดนี้ หรือไม่มีข้อมูลสำหรับตำแหน่ง/ช่วงเวลานี้
429Too Many Reqsเรียกเกินขีดจำกัด — รอแล้วลองใหม่หลังรอบเวลารีเซ็ต
500Server Errorเกิดข้อผิดพลาดที่ไม่คาดคิด — ติดต่อ support@globmaps.com พร้อม request ID

ผลตอบกลับที่เป็นข้อผิดพลาดทั้งหมดมีรูปแบบ: { "error": "Human-readable message." }

แหล่งที่มาของข้อมูล

Contains modified Copernicus Climate Change Service information 2026. Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.

คำแปล: มีข้อมูลจาก Copernicus Climate Change Service ที่ผ่านการดัดแปลง ปี 2026 ทั้งคณะกรรมาธิการยุโรปและ ECMWF ไม่รับผิดชอบต่อการนำข้อมูลหรือสารสนเทศของ Copernicus ที่อยู่ในนี้ไปใช้ในทางใดก็ตาม

Data sources: ERA5 (Copernicus/ECMWF) · SEAS5 seasonal forecast · NOAA GHCND station data · GloFAS river discharge.

Administrative boundaries: geoBoundaries (gbOpen), Runfola et al. (2020); the licence is set per country by the source dataset. Thailand: © OpenStreetMap contributors, ODbL 1.0.

MDI scores are probabilistic estimates for decision-support purposes. Not intended as the sole basis for critical infrastructure, financial, or emergency decisions. Applications using this API must display: "Powered by GlobMaps MDI".

คำแปล: คะแนน MDI เป็นค่าประมาณเชิงความน่าจะเป็น ใช้เพื่อประกอบการตัดสินใจ ไม่ได้มีไว้เพื่อใช้เป็นเกณฑ์เพียงอย่างเดียวในการตัดสินใจเกี่ยวกับโครงสร้างพื้นฐานที่สำคัญ การเงิน หรือเหตุฉุกเฉิน แอปพลิเคชันที่ใช้ API นี้ต้องแสดงข้อความ "Powered by GlobMaps MDI"

ความช่วยเหลือ