City Lookup

Platform: API iOS Android

City Lookup provides reverse geocoding, geolocation lookup services, supports multi-language, fuzzy search and other functions.

Interface code (Enum) Interface Class
INQUIRE_TYPE_GEO_CITY_LOOKUP City lookup GeoBaseClass

Request Parameters

If no optional parameters are set, the default value will be used.

  • appKey(required)API authentication key, please refer to How To Get Your Key. For example: appKey=12334567890ABC
  • 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
  • langMulti-language setting, please see Language to find out how our multi-language works and how to set up.
  • 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.

Sample Code

    QWeatherConfigInstance.publicID = @"publicID";
    QWeatherConfigInstance.appKey = @"key";
    QWeatherConfigInstance.appType = APP_TYPE_BIZ;
    QWeatherConfigInstance.location = @"beijing";
    [QWeatherConfigInstance weatherWithInquireType:INQUIRE_TYPE_GEO_CITY_LOOKUP WithSuccess:^(GeoBaseClass *responseObject) {
        
        NSLog(@"Description->%@",[responseObject description]);
        
    } faileureForError:^(NSError *error) {
        NSLog(@"error->%@",error);
        
    }];

Response

Parameters Description Example
code Status code, please refer to Status Code 200
location.name Location Name Nanshan District
location.cid Location ID 101280604
location.lat Location latitude 22.53122
location.lon Location longitude 113.92942
location.adm2 Name of the superior administrative division of the location Shenzhen
location.adm1 The first-level administrative region of the location Guangdong Province
location.country Country name of the location China
location.tz Timezone of the location +0800
location.utcOffset The number of hours offset between local time and UTC time, refer to UTC-Offset +08:00
location.isDst Is the location currently observing Daylight Saving time
1 in daylight saving time
0 not in daylight saving time
0
location.type Type of the location city
location.rank Location Rank 10
location.fxLink Responsive web page of this location, easy to embed in your website or APP http://hfx.link/34T5
refer.sources Data source and other statements, may be null  
refer.license License, may be null