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

Type: double

Latitude, in degrees.

lon

Type: double

Longitude, in degrees.

func

Type: 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

Type: gpointer

For customization.

The argument can be NULL.
The data is owned by the caller of the method.
destroy

Type: GDestroyNotify

To destroy user_data.

Return value

Type: 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 returned data, and is responsible for freeing it.