This call undoes the effect of gweather_location_serialize(), that
is, it turns a #GVariant into a #GWeatherLocation. The conversion
happens in the context of world
(i.e, for a city or weather station,
the resulting location will be attached to a administrative division,
country and region as appropriate).
Initializes geocode reversing to find place for (lat,
lon)
coordinates. Calls the callback
function passed by user when the result is ready.
loc
must be at most a %GWEATHER_LOCATION_ADM1 location.
This restriction may be lifted in a future version.
Latitude, in degrees
Longitude, in degrees
optional, NULL to ignore
callback function for GAsyncReadyCallback argument for GAsyncResult
Compares two #GWeatherLocation and sees if they represent the same place. It is only legal to call this for cities, weather stations or detached locations. Note that this function only checks for geographical characteristics, such as coordinates and METAR code. It is still possible that the two locations belong to different worlds (in which case care must be taken when passing them GWeatherLocationEntry and GWeatherInfo), or if one is them is detached it could have a custom name.
Retrieves the weather station identifier by station_code
.
Note that multiple instances of the same weather station can exist
in the database, and this function will return any of them, so this
not usually what you want.
See gweather_location_deserialize() to recover a stored #GWeatherLocation.
Prior to version 40 no reference was returned.
a 4 letter METAR code
Finds the nearest city to the passed latitude and
longitude, among the descendants of loc
.
loc
must be at most a %GWEATHER_LOCATION_ADM1 location.
This restriction may be lifted in a future version.
Note that this function does not check if (lat,
lon)
fall inside
loc,
or are in the same region and timezone as the return value.
Latitude, in degrees
Longitude, in degrees
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.
Latitude, in degrees
Longitude, in degrees
returns true to continue check for the location and false to filter the location out
For a %GWEATHER_LOCATION_CITY or %GWEATHER_LOCATION_DETACHED location, this is equivalent to gweather_location_get_name(). For a %GWEATHER_LOCATION_WEATHER_STATION location, it is equivalent to calling gweather_location_get_name() on the location's parent. For other locations it will return %NULL.
Gets the METAR station code associated with a %GWEATHER_LOCATION_WEATHER_STATION location.
Gets loc'
s coordinates; you must check
gweather_location_has_coords() before calling this.
Gets the ISO 3166 country code of loc
(or %NULL if loc
is a
region- or world-level location)
Gets the country name of loc. For a %GWEATHER_LOCATION_COUNTRY location, this is equivalent to gweather_location_get_name(). For a %GWEATHER_LOCATION_REGION and GWEATHER_LOCATION_WORLD location it will return %NULL. For other locations it will find the parent %GWEATHER_LOCATION_COUNTRY and return its name.
Gets loc'
s English name.
Gets loc'
s english "sort name", which is the english name after having
g_utf8_normalize() (with %G_NORMALIZE_ALL) and g_utf8_casefold()
called on it. You can use this to sort locations, or to comparing
user input against a location name.
Gets loc'
s level, from %GWEATHER_LOCATION_WORLD, to
%GWEATHER_LOCATION_WEATHER_STATION.
Gets loc'
s name, localized into the current language.
Gets loc'
s "sort name", which is the name after having
g_utf8_normalize() (with %G_NORMALIZE_ALL) and g_utf8_casefold()
called on it. You can use this to sort locations, or to comparing
user input against a location name.
Gets the timezone associated with loc,
if known, as a string.
The timezone string is owned either by loc
or by one of its
parents, do not free it.
Checks if loc
has valid latitude and longitude.
Allows iterating all children. Pass %NULL to get the first child,
and any child to get the next one. Note that the reference to child
is taken, meaning iterating all children is as simple as:
g_autoptr(GWeatherLocation) child = NULL;
while ((child = gweather_location_next_child (location, child)))
{
// Do something with child
}
Transforms a #GWeatherLocation into a #GVariant, in a way that calling gweather_location_deserialize() will hold an equivalent #GWeatherLocation. The resulting variant can then be stored into GSettings or on disk. This call is only valid for cities, weather stations and detached locations. The format of the resulting #GVariant is private to libgweather, and it is subject to change. You should use the "v" format in GSettings, to ensure maximum compatibility with future versions of the library.
Subtracts 1 from loc'
s reference count, and frees it if the
reference count reaches 0.
Construct a new location from the given data, supplementing any missing information from the static database.
the user visible location name
the ICAO code of the location
the latitude of the location
the longitude of the location
A #GWeatherLocation represents a "location" of some type known to libgweather; anything from a single weather station to the entire world. See #GWeatherLocationLevel for information about how the hierarchy of locations works.