City Lookup

Platform: API iOS Android

With the City Lookup, you can get the basic information of the city, including the Location ID of the city (you need this ID to get the weather), multilingual name, latitude and longitude, time zone, altitude, rank, administrative, etc.

Interface Code Interface Class
getGeoGityLookup City lookup GeoBean

Parameter

  • location(required)The location to be queried, support text, LocationID, comma-separated longitude and latitude (decimal, up to 2 decimal places), Adcode(Chinese cities only). For example: location=beijing or location=116.41,39.92
  • admSuperior administrative divisions of a city, useful for excluding cities with similar names or for filtering results. Example adm = beijing
  • rangeSet 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
  • numberNumber of the results in response, from 1 to 20, 10 is the default.
  • langMulti-language, default Chinese, if data does not match the language you set, it will return in English or its native language. Language parameter please refer to Language

Sample Code

QWeather.getGeoCityLookup(Context context, String location, String adm, Range range, int number, Lang lang, final QWeather.OnResultGeoListener listener);

QWeather.getGeoCityLookup(Context context, String location, Range range, int number, Lang lang, final QWeather.OnResultGeoListener listener);

QWeather.getGeoCityLookup(Context context, String location, int number, Lang lang, final QWeather.OnResultGeoBeansListener listener);

QWeather.getGeoCityLookup(Context context, String location, final QWeather.OnResultGeoBeansListener listener);

Properties

Properties of GeoBean

Property Description Example
getCode See Status Code 200
getLocationBean City data List<LocationBean>

Refer

Property Description Example
getSourcesList Data source and other statements QWeather
getLicenseList Data license QWeather Developers License

LocationBean Basic Information

Property Description Example
getName Location Name Zhuozi
getId Location ID 101080402
getLon Location longitude 112.577702
getLat Location latitude 40.89576
getAdm2 Name of the superior administrative division of the location Ulan Qab
getAdm1 The first-level administrative region of the location Inner Mongolia
getCountry Country name of the location China
getTz Location Timezone Asia/Shanghai
getUtcOffset The number of hours offset between local time and UTC time, refer to UTC-Offset +08:00
getIsDst Is the location currently observing Daylight Saving time
1 in daylight saving time
0 not in daylight saving time
0
getType Type of the location city
getRank Location Rank 10
getFxLink Responsive web page of this location, easy to embed in your website or APP https://www.qweather.com/weather/zhuozi-101080402.html