Get City Information by Longitude and Latitude

Last Updated on : 2023-06-15 05:33:54

Get detailed information about a specified city by longitude and latitude, including city ID, country name, and city name.

API address

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

Request parameter

Parameter nameTypeINRequiredDescription
lonStringquerytrueThe longitude.
latStringquerytrueThe latitude.

Return parameter

Parameter nameTypeDescription
resultAreaResThe returned result.

Description of result

Parameter nameTypeDescription
city_idStringThe ID of a specified city.
city_nameStringThe name of a specified city.
province_nameStringThe name of a specified province.
lonStringThe longitude.
parent_city_nameStringThe name of the superior city.
country_nameStringThe name of the country.
parent_idStringThe ID of a specified parent node.
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": "793416838607409***",
        "country_name": "China",
        "lat": "27.8666",
        "city_id": "793409524550733***"
    },
    "t": 1637833868025,
    "success": true
}

Error code

For more information, see error code.