Предложение геолокации
API Яндекс Погоды может предоставлять топонимы, предлагаемые любым текстовым вводом.
Конечная точка возвращает список топонимов, аналогичных вводимому тексту, с некоторыми дополнительными данными, такими как координаты (широта
, долгота
).
Например, только один входной параметр - part=<any text>
.
Пример запроса:
curl 'https://api.weather.yandex.ru/v2/geo-suggest?part=Lond' -H 'X-Yandex-Weather-Key: <Key>'
Ответ на запрос
[
"Lond",
[
{
"name": "London",
"name_short": "London",
"kind": "weather",
"lat": 51.50735092,
"lon": -0.1276949942,
"url": "//yandex.ru/pogoda?name=London&kind=weather",
"spnlat": 0.4579849243,
"spnlon": 0.8298630118,
"geoid": 10393,
"slug": "10393",
"hl": [
[
0,
4
]
]
},
{
"name": "Londrina, State of Paraná",
"name_short": "Londrina",
"kind": "weather",
"lat": -23.29758263,
"lon": -51.16018677,
"url": "//yandex.ru/pogoda?name=State+of+Paran%C3%A1%2C+Londrina&kind=weather",
"spnlat": 0.04979705811,
"spnlon": 0.06839752197,
"geoid": 109471,
"slug": "109471",
"hl": [
[
0,
4
]
]
},
{
"name": "East London",
"name_short": "East London",
"kind": "weather",
"lat": -33.00016022,
"lon": 27.86773491,
"url": "//yandex.ru/pogoda?name=East+London&kind=weather",
"spnlat": 0.1546325684,
"spnlon": 0.2101173401,
"geoid": 114222,
"slug": "114222",
"hl": [
[
5,
9
]
]
},
{
"name": "London, Province of Ontario",
"name_short": "London",
"kind": "weather",
"lat": 42.98889542,
"lon": -81.23149109,
"url": "//yandex.ru/pogoda?name=Province+of+Ontario%2C+London&kind=weather",
"spnlat": 0.141494751,
"spnlon": 0.1943969727,
"geoid": 103569,
"slug": "103569",
"hl": [
[
0,
4
]
]
},
{
"name": "County Londonderry",
"name_short": "County Londonderry",
"kind": "geobase_region",
"lat": 54.99627686,
"lon": -7.309168816,
"url": "//yandex.ru/pogoda?name=County+Londonderry&kind=geobase_region",
"spnlat": 0.7066879272,
"spnlon": 0.9514513016,
"geoid": 104581,
"slug": "104581",
"hl": [
[
7,
11
]
]
},
{
"name": "Londonderry, State of New Hampshire",
"name_short": "Londonderry",
"kind": "weather",
"lat": 42.8646965,
"lon": -71.37458801,
"url": "//yandex.ru/pogoda?name=State+of+New+Hampshire%2C+Londonderry&kind=weather",
"spnlat": 0.0969543457,
"spnlon": 0.1318054199,
"geoid": 110350,
"slug": "110350",
"hl": [
[
0,
4
]
]
},
{
"name": "London, Commonwealth of Kentucky",
"name_short": "London",
"kind": "weather",
"lat": 37.12849426,
"lon": -84.08348846,
"url": "//yandex.ru/pogoda?name=Commonwealth+of+Kentucky%2C+London&kind=weather",
"spnlat": 0.02833557129,
"spnlon": 0.03512573242,
"geoid": 103511,
"slug": "103511",
"hl": [
[
0,
4
]
]
},
{
"name": "Londoko-Zavod, Obluchensky District, Jewish Autonomous Oblast",
"name_short": "Londoko-Zavod",
"kind": "weather",
"lat": 49.01180267,
"lon": 131.936676,
"url": "//yandex.ru/pogoda?name=Jewish+Autonomous+Oblast%2C+Obluchensky+District%2C+Londoko-Zavod&kind=weather",
"spnlat": 0.03086853027,
"spnlon": 0.04040527344,
"geoid": 148809,
"slug": "148809",
"hl": [
[
0,
4
]
]
},
{
"name": "Londoko, Obluchensky District, Jewish Autonomous Oblast",
"name_short": "Londoko",
"kind": "weather",
"lat": 49.01512909,
"lon": 131.9954987,
"url": "//yandex.ru/pogoda?name=Jewish+Autonomous+Oblast%2C+Obluchensky+District%2C+Londoko&kind=weather",
"spnlat": 0.01605987549,
"spnlon": 0.03378295898,
"geoid": 128330,
"slug": "128330",
"hl": [
[
0,
4
]
]
},
{
"name": "Londolovit",
"name_short": "Londolovit",
"kind": "weather",
"lat": -3.078332901,
"lon": 152.6333313,
"url": "//yandex.ru/pogoda?name=Londolovit&kind=weather",
"spnlat": 0,
"spnlon": 0,
"geoid": 114065,
"slug": "114065",
"hl": [
[
0,
4
]
]
}
]
]
Если вам нужна эта функциональность, свяжитесь с нами.
Была ли статья полезна?
Предыдущая
Следующая