GeoAPI
For Android SDK v4.9Weather data is based on geographic location, so you need to know specific location information before getting the weather. QWeather provides a powerful GeoAPI service, which can obtain the basic information of the city that needs to be queried, including the location ID of the city or region (you need this ID to query the weather), multilingual name, latitude and longitude, time zone, altitude, Rank value, administrative division, etc.
In addition, the GeoAPI service can also help you:
- Avoid the trouble of the same name city
- Return multiple city results based on the name entered by the user in your APP or website, so that the user can select an accurate city and return the city’s weather
- Display popular cities in your APP or website, users can directly select, reduce search steps and improve user experience
- No need to maintain the city list, city information updates are obtained in real time
GeoAPI is free for the first 50,000 calls per day for each account, more calls refer to price
City Lookup
Interface Code | Interface | Class |
---|---|---|
getGeoGityLookup | City lookup | GeoBean |
Parameter
location
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
adm
Superior administrative divisions of a city, useful for excluding cities with similar names or for filtering results.
For example adm = beijing
range
Set to search only within a certain country. The country name needs to use country code ISO 3166.
world
Around the world, defaultcn
Chinaus
United Statesfr
Franceuk
United Kingdomru
Russia- See more country code
number
Number of the results in response, from 1 to 20, 10 is the default
lang
Multi-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, Range range, int number, Lang lang, final QWeather.OnResultGeoListener listener);
QWeather.getGeoCityLookup(Context context, Range range, final QWeather.OnResultGeoBeansListener listener);
QWeather.getGeoCityLookup(Context context, String location, final QWeather.OnResultGeoBeansListener listener);
Properties
Properties of GeoBean
Property | Description | Example |
---|---|---|
getCode | Status code, please refer to Status Code | Code |
getLocationBean | City data | List<LocationBean> |
Refer
Property | Description | Example |
---|---|---|
getSourcesList | Data source and other statements | qweather.com |
getLicenseList | Data license | commercial 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 time1 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 | http://hfx.link/ae45 |
Top City
Interface Code | Interface | Class |
---|---|---|
getGeoTopCity | Top city | GeoBean |
Parameter
range
Set to search only within a certain country. The country name needs to use country code ISO 3166.
world
Around the world, defaultcn
Chinaus
United Statesfr
Franceuk
United Kingdomru
Russia- See more country code
number
Number of the results in response, from 1 to 20, 10 is the default
lang
Multi-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.getGeoTopCity(Context context, int number, Range range, Lang lang, final QWeather.OnResultGeoBeansListener listener);
QWeather.getGeoTopCity(Context context, final QWeather.OnResultGeoBeansListener listener);
Properties
Properties of GeoBean
Property | Description | Example |
---|---|---|
getCode | Status code, please refer to Status Code | Code |
getLocationBean | City data | List<LocationBean> |
Refer
Property | Description | Example |
---|---|---|
getSourcesList | Data source and other statements | qweather.com |
getLicenseList | Data license | commercial license |
LocationBean Basic Information
Property | Description | Example |
---|---|---|
getName | Location Name | Zhuozi |
getId | Location ID | 101080402 |
getLon | Longitude of the location | 112.577702 |
getLat | Latitude of the location | 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 time1 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 | http://hfx.link/ae45 |
POI Lookup
Interface Code | Interface | Class |
---|---|---|
getGeoPoiLookup | POI lookup | GeoPoiBean |
Parameter
location
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
type
Choose to search for a certain type of POI.
scenic
Scenic SpotCSTA
Currents StationTSTA
Tide Station
city
Search for POI within a given city. The city name can be text or the city’s LocationID.
The city name is an exact match. It is recommended to use LocaitonID. If the text cannot be matched, the data returned will be empty.
number
Number of the results in response, from 1 to 20, 10 is the default
lang
Multi-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.getGeoPoiLookup(Context context, String location, String city, int number, Type type, Lang lang, final OnResultGeoPoiListener listener);
QWeather.getGeoPoiLookup(Context context, String location, Type type, final QWeather.OnResultGeoPoiListener listener);
Properties
Properties of GeoPoiBean
Property | Description | Example |
---|---|---|
getCode | Status code, please refer to Status Code | Code |
getPoiList | City data | List<Poi> |
Refer
Property | Description | Example |
---|---|---|
getSourcesList | Data source and other statements | qweather.com |
getLicenseList | Data license | commercial license |
Poi
Property | Description | Example |
---|---|---|
getName | POI name | Nanshan District |
getId | Location ID | 101280604 |
getLon | Longitude of the POI | 22.53122 |
getLat | Latitude of the POI | 113.92942 |
getAdm2 | Name of the superior administrative division of the POI | Shenzhen |
getAdm1 | The first-level administrative region to which the POI belongs | Guangdong Province |
getCountry | Country name of the POI | China |
getTz | Timezone of the POI | 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 time1 in daylight saving time 0 not in daylight saving time |
0 |
getType | POI type | scenic |
getRank | Location Rank | 10 |
POI Range
Interface Code | Interface | Class |
---|---|---|
getGeoPoiRange | POI Range | GeoPoiBean |
Parameter
location
The comma-separated longitude and latitude (decimal, up to 2 decimal places) of the location to be queried.
For example: location=116.41,39.92
type
Choose to search for a certain type of POI.
scenic
Scenic SpotCSTA
Currents StationTSTA
Tide Station
radius
Set search radius, the value range is 1-50, in kilometers. 5 by default.
number
Number of the results in response, from 1 to 20, 10 is the default
lang
Multi-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.getGeoPoiRange(Context context, String location, int radius, int number, Type type, Lang lang, final OnResultGeoPoiListener listener);
QWeather.getGeoPoiRange(Context context, String location, int number, Type type, Lang lang, final OnResultGeoPoiListener listener);
Properties
Properties of GeoPoiBean
Property | Description | Example |
---|---|---|
getCode | Status code, please refer to Status Code | Code |
getPoiList | City data | List<Poi> |
Refer
Property | Description | Example |
---|---|---|
getSourcesList | Data source and other statements | qweather.com |
getLicenseList | Data license | commercial license |
Poi
Property | Description | Example |
---|---|---|
getName | POI name | Nanshan District |
getId | Location ID | 101280604 |
getLon | Longitude of the POI | 22.53122 |
getLat | Latitude of the POI | 113.92942 |
getAdm2 | Name of the superior administrative division of the POI | Shenzhen |
getAdm1 | The first-level administrative region to which the POI belongs | Guangdong Province |
getCountry | Country name of the POI | China |
getTz | Timezone of the POI | 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 time1 in daylight saving time 0 not in daylight saving time |
0 |
getType | POI type | scenic |
getRank | Location Rank | 10 |