City Lookup
City Lookup provides global geolocation and city search services, including reverse geocoding, multilingual results, and fuzzy search.
Weather data is location-based, so you need to identify a location before requesting weather data. City Lookup returns basic location information, including the Location ID, multilingual names, latitude and longitude, time zone, elevation, rank, and administrative divisions.
Endpoint#
GET /geo/v2/city/lookupParameters#
Query parameters
-
location requiredstringThe location to be queried, support location name, LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example:
location=beijingorlocation=101010100orlocation=116.41,39.92 -
admstringSuperior administrative divisions of a city, useful for excluding cities with similar names or for filtering results. Example
adm = beijing -
rangestringSet to search only within a certain country or region. The country and region name needs to use country code ISO 3166. If this parameter is not set, the search range will be all cities. Example:
range=cn -
numberintegerNumber of the results in response, from 1 to 20, 10 is the default.
-
langstringLanguage setting. See Language for behavior, configuration, and data availability
Request example#
curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/geo/v2/city/lookup?location=116.41%2C39.92'
Replace your_token and your_api_host with your JWT Authentication and API Host
Response#
{
"code": "200",
"location": [
{
"name": "Dongcheng",
"id": "101011600",
"lat": "39.91755",
"lon": "116.41876",
"adm2": "Beijing",
"adm1": "Beijing",
"country": "China",
"tz": "Asia/Shanghai",
"utcOffset": "+08:00",
"isDst": "0",
"type": "city",
"rank": "35",
"fxLink": "https://www.qweather.com/weather/dongcheng-101011600.html"
}
],
"refer": {
"sources": [
"https://developer.qweather.com/attribution.html"
],
"license": [
"QWeather Developers License"
]
}
}-
codestring
-
locationarrayLocation information list
-
namestringLocation Name
-
idstringLocation ID
-
latstringLatitude
-
lonstringLongitude
-
adm2stringName of the superior administrative division of the location
-
adm1stringThe first-level administrative area of the location
-
countrystringCountry name
-
tzstringTimezone for this location
-
utcOffsetstringThe number of hours offset between local time and UTC time, refer to UTC Offset
-
isDststring
-
typestringLocation type
-
rankstring
-
fxLinkuriResponsive web page of this location, easy to embed in your website or APP
-
-
referobjectData sources and licensing information
-
sourcesarrayData source and other statements, may be null
-
licensearrayData license, may be null
-