نقطه پایانی publicAlerts جزئیات هشدارهای مربوط به رویدادهای خاص آب و هوایی را که توسط آژانسهای معتبر ملی و بینالمللی صادر شدهاند، ارائه میدهد. این هشدارها اطلاعات حیاتی و بالقوه نجاتبخش را ارائه میدهند.
The endpoint returns weather alerts occurring in real time for a given latitude and longitude. Supported weather events include the following:
- Precipitation: Rain, snow, hail, droughts, and more
- Extreme temperatures: Cold, heat, freeze, frost, wind chill, and humidity
- Wind and storm events: Blizzards, hurricanes, tornados, tropical storms, thunderstorms, and more
- Visibility impairments: Fog, dust storms, and blowing snow
- Water-related hazards: Floods, tsunamis, storm surges, coastal hazards, and more
- Geophysical and geological events: Earthquakes, landslides, and volcanic activity
- حوادث آتشسوزی: آتشسوزیهای جنگلی، آب و هوای آتشسوزی و موارد دیگر
For a complete list of supported weather events, see Weather event types .
بسته به آنچه از منبع داده در دسترس است، هشدارها ممکن است حاوی توضیحات محلی باشند یا نباشند. به دلیل محدودیتهای منبع داده، اطلاعات به همان صورت (محتوای خام) ارائه میشوند. برای اطلاعات بیشتر در مورد منابع هشدار آب و هوا، به منابع داده مراجعه کنید.
The API returns the following information for a given weather alert:
- The type of weather event associated with the alert
- A list of affected areas along with coordinates defining the geographical boundaries of those areas
- خلاصهای یک جملهای از رویداد آب و هوایی
- سطوح شدت، قطعیت و فوریت
- A description of action-recommend instructions for the target audience
- توصیههای ایمنی
- زمان شروع و پایان هشدار
- نام و وبسایت مرجع انتشار
مرورگر APIها به شما امکان میدهد درخواستهای زنده ارسال کنید تا بتوانید با API و گزینههای API آشنا شوید:
درباره درخواستهای هشدار آب و هوا
To request weather alert information, send an HTTP GET request to:
https://weather.googleapis.com/v1/publicAlerts:lookup?key=YOUR_API_KEY&location.latitude=LATITUDE&location.longitude=LONGITUDE&languageCode=LANGUAGE_CODE
Include the latitude and longitude coordinates of the location in your request URL parameters.
درباره پاسخهای هشدار آب و هوا
The Weather API returns the following fields in the response body:
| میدان | نوع | توضیحات | الزامی یا اختیاری |
|---|---|---|---|
alertId | رشته | The alert ID. This can also be found on the data provider website. | مورد نیاز |
alertTitle | رشته | The title of the alert, which describes the weather event. Note: This is the only string that is translated when a language code parameter is included in the request. | مورد نیاز |
eventType | شمارشی | The type of weather event associated with the alert. For a full list of supported weather events, see Weather event types . | مورد نیاز |
areaName | رشته | The name of the geographic area affected by the alert, which includes the requested location. | مورد نیاز |
polygon | رشته | Coordinates defining a closed dimensional area of the alert. | اختیاری |
description | رشته | A short phrase that summarizes the event description in the specified language (for example, "Tornado warning"). | اختیاری |
severity | شمارشی | سطح شدت هشدار:
| اختیاری |
certainty | شمارشی | سطح اطمینان برای هشدار:
| اختیاری |
urgency | شمارشی | میزان فوریت برای هشدار:
| اختیاری |
instruction | رشته | Description of responsive action instructions for the target audience. | اختیاری |
safetyRecommendations | رشته | Safety recommendations based on public authority codes. Includes top-level directives and subtext with additional information. | اختیاری |
timezoneOffset | رشته | The timezone offset of the event, in +/-HH:MM format. | مورد نیاز |
startTime | تاریخ و زمان | The effective Epoch date and time (UTC time) of the information in the alert message. | اختیاری |
expirationTime | تاریخ و زمان | The Epoch date and time (UTC time) that an alert is expected to end. It may be null for indefinitely long events, in which case the headline will indicate that the event is "in effect". | اختیاری |
dataSource | شمارشی | Authority details including publisher, name, and URL. | مورد نیاز |
regionCode | شمارشی | Region code of the location that has been requested. | اختیاری |
منابع داده
نقطه پایانی هشدارهای آب و هوایی، دادههای منتشر شده توسط ارائه دهندگان ذکر شده در جدول زیر را برمیگرداند. بر اساس مختصات طول و عرض جغرافیایی ارائه شده در درخواست، بدنه پاسخ، دادهها را از مرجع محلی مربوطه ارائه میدهد.
Providers included in the feed follow Google's Public Alerts guidelines . Google may update the list of providers at any time.
انتساب
On all displays where the data is presented, the customer application must include an attribution to the original source using the dataSource field:
"dataSource": {
"publisher": "NOAA",
"name": "National Weather Service",
"authorityUri": "https://www.weather.gov/"
}
این انتساب باید شامل نام کامل منبع داده (مطابق با فیلد name ) و پیوند به منبع داده با استفاده از URL ارائه شده در فیلد authorityUri (برای مثال، « سرویس ملی هواشناسی ») باشد.
انواع رویدادهای آب و هوایی
انواع رویدادهای آب و هوایی زیر پشتیبانی میشوند:
| انواع رویدادهای آب و هوایی | |
|---|---|
ACID_RAINAVALANCHEBLIZZARDBLOWING_SNOWCOASTAL_FLOODCOASTAL_HAZARDCOLDCYCLONEDROUGHTEXTRATROPICAL_CYCLONEFIRE_WEATHERFLASH_FLOODFLOODFOGFREEZINGFREEZING_AIR_TEMPERATUREFREEZING_DRIZZLEFREEZING_RAINFROSTGALEGLAZEHAILHAZARDOUS_SEASHEATHUMIDITYHURRICANEICE_STORMLAKE_EFFECT_SNOWMONSOONMUDDY_FLOODOUTFLOWRAIN | RIVER_FLOODINGSEVERE_THUNDERSTORM_WARNINGSNOWSNOWSQUALLSTORMSTORM_SURGETHUNDERTHUNDERSTORMTORNADOTORNADO_WARNINGTROPICAL_CYCLONETROPICAL_CYCLONE_WARNINGS_AND_WATCHESTROPICAL_DISTURBANCETROPICAL_STORMTYPHOONWINDWIND_CHILLWIND_WAVEWINTER_STORMWILDFIREBUSHFIREFIRELANDSLIDEEARTHQUAKEDUST_STORMAFTERSHOCKTSUNAMIVOLCANIC_ASHVOLCANIC_ERUPTIONRADIATION |
رفتار ترجمه پاسخ
گوگل فقط برای فیلد alertTitle ترجمه ارائه میدهد. فیلدهای دیگری مانند eventType ، areaName ، instruction و safetyRecommendations نیز ممکن است بسته به پشتیبانی زبان منبع داده اصلی ترجمه شوند؛ با این حال، گوگل نمیتواند ترجمههای مستقلی برای این فیلدها ارائه دهد.
Based on the languageCode parameter included in the request, the following behaviors are expected for the alertTitle field:
- Supported
languageCode: If the requestedlanguageCodeis both provided and supported, the response is returned in the requested language. - Unsupported
languageCode: In cases where the requestedlanguageCodeis not supported and a close alternative cannot be found, the endpoint returns the response in English by default. - No
languageCodeprovided: The endpoint returns the response in English by default.
مثال درخواست هشدار آب و هوا
The following example requests weather alert information for a town in North Carolina:
curl -X GET "https://weather.googleapis.com/v1/publicAlerts:lookup?key=YOUR_API_KEY&location.latitude=35.824635 &location.longitude=-78.3168047 &languageCode=en"
بدنه پاسخ به شرح زیر است:
{ "weatherAlerts": [ { "alertId": "urn:oid:2.49.0.1.840.0.2416b1b5a6f51d29ef4b94948328dca303fbbb5c.001.1", "alertTitle": { "text": "Flash Flood Warning", "languageCode": "en" }, "eventType": "FLASH_FLOOD", "areaName": "Franklin, NC; Johnston, NC; Nash, NC; Wake, NC", "polygon": "{\"type\":\"Polygon\",\"coordinates\":[[[-78.450000,35.820000],[-78.410000,35.730000],[-78.280000,35.660000],[-78.180000,35.740000],[-77.840000,36.150000],[-77.890000,36.140000],[-77.900000,36.160000],[-77.920000,36.170000], [-77.930000,36.190000], [-77.940000,36.190000],[-77.950000,36.180000],[-77.970000,36.190000],[-77.970000,36.180000], [-77.980000,36.180000],[-78.010000,36.210000],[-78.040000,36.210000],[-78.110000,36.210000],[-78.130000,36.230000], [-78.350000,35.940000],[-78.450000,35.820000]]]}", "description": "FFWRAH\n\nThe National Weather Service in Raleigh has issued a\n\n* Flash Flood Warning for... \nEastern Franklin County in central North Carolina...\nNorth Central Johnston County in central North Carolina... \nWestern Nash County in central North Carolina...\nEast Central Wake County in central North Carolina... \n\n* Until 530 PM EDT.\n\n* At 224 PM EDT, local law enforcement reported flash flooding in\nSpring Hope. Between 3 and 5 inches of rain have fallen. \nAdditional rainfall amounts of 1 to 3 inches are possible in the\nwarned area.\n\nHAZARD...Life threatening flash flooding. Heavy rain producing\nflash flooding.\n\nSOURCE...Law enforcement reported.\n\nIMPACT...Life threatening flash flooding of creeks and streams,\nurban areas, highways, streets and underpasses.\n\n* Some locations that will experience flash flooding include... \nZebulon, Bunn, Wendell, Spring Hope, Middlesex, Castalia,\nCenterville, Pilot, Emit and Aventon.", "severity": "SEVERE", "certainty": "LIKELY", "urgency": "IMMEDIATE", "instruction": [ "Turn around, don't drown when encountering flooded roads. Most flood\ndeaths occur in vehicles." ], "safetyRecommendations": [ { "directive": "Build an emergency kit and make a family communications plan.", "subtext": "Follow the instructions at http://www.ready.gov/build-a-kit for building an emergency kit and http://www.ready.gov/make-a-plan for a family communications plan." }, { "directive": "Be aware that flash flooding can occur. ", "subtext": "If there is any possibility of a flash flood, move immediately to higher ground. Do not wait for instructions to move." }, ... ], "timezoneOffset": "-14400s", "startTime": "2025-08-06T18:24:00Z", "expirationTime": "2025-08-06T21:30:00Z", "dataSource": { "publisher": "NOAA", "name": "National Weather Service", "authorityUri": "https://www.weather.gov/" } } ], "regionCode": "US" }
امتحانش کن!
The APIs Explorer lets you make sample requests so that you can get familiar with the API and the API options.
Select the API icon api on the right side of the page.
در صورت تمایل، پارامترهای درخواست را ویرایش کنید.
Select the Execute button. In the dialog, choose the account that you want to use to make the request.
In the APIs Explorer panel, select the fullscreen icon fullscreen to expand the APIs Explorer window.