Query City by Longitude and Latitude

Last Updated on : 2023-09-22 01:43:28download

Get details of the specified city by longitude and latitude, including country or region name, city ID, and city name.

API address

GET: /v1.0/iot-03/cities/positions

Request parameter

Parameter nameTypeINRequiredDescription
lonStringquerytrueThe longitude, accurate to 6 digits after the decimal separator.
latStringquerytrueThe latitude, accurate to 6 digits after the decimal separator.

Return parameter

Parameter nameTypeDescription
resultCityDetailResThe returned result.

Description of result

Parameter nameTypeDescription
city_idStringThe ID of the specified city.
city_nameStringThe name of the specified city.
province_nameStringThe name of the specified province.
country_nameStringThe name of the specified country or region.
parent_idStringThe ID of the specified parent administrative district.
parent_city_nameStringThe name of the specified parent administrative district.
lonStringThe longitude.
latStringThe latitude.

Request example

GET: /v1.0/iot-03/cities/positions?lon=112.908065&lat=27.866636

Return example

{
    "result": {
        "parent_city_name": "Xiangtan City",
        "lon": "112.9080",
        "province_name": "Hunan Province",
        "city_name": "Xiangtan City",
        "parent_id": "793416838607409152",
        "country_name": "China",
        "lat": "27.8666",
        "city_id": "793409524550733824"
    },
    "t": 1637833868025,
    "success": true
}

Error code

For more information, see error code.