Method

GWeatherLocationfind_nearest_city_full

Declaration [src]

GWeatherLocation*
gweather_location_find_nearest_city_full (
  GWeatherLocation* loc,
  double lat,
  double lon,
  GWeatherFilterFunc func,
  gpointer user_data,
  GDestroyNotify destroy
)

Description [src]

Finds the nearest city to the passed latitude and longitude, among the descendants of loc.

Supports the use of own filter function to filter out locations.

Geocoding should be done on the application side if needed.

loc must be at most a GWEATHER_LOCATION_ADM1 location. This restriction may be lifted in a future version.

Parameters

lat double
 

Latitude, in degrees.

lon double
 

Longitude, in degrees.

func GWeatherFilterFunc
 

A function to iterate over the locations; the function must return TRUE to continue checking for the location, and FALSE to filter the location out.

 The argument can be NULL.
user_data gpointer
 

For customization.

 The argument can be NULL.
destroy GDestroyNotify
 

To destroy user_data.

Return value

Returns: GWeatherLocation
 

The city closest to (lat, lon), in the region or administrative district of loc with validation of filter function.

 The caller of the method takes ownership of the data, and is responsible for freeing it.