Location
Object Hierarchy:
Description:
[ CCode ( ref_function = "gweather_location_ref" , type_id = "gweather_location_get_type ()" , unref_function = "gweather_location_unref" ) ]
[ Compact ]
public class Location
[ Compact ]
public class Location
A Location represents a "location" of some type known to libgweather; anything from a single weather station to the entire world.
See LocationLevel for information about how the hierarchy of locations works.
Namespace: GWeather
Package: gweather-3.0
Content:
Static methods:
- public static Location? get_world ()
Creation methods:
- public Location.detached (string name, string? icao, double latitude, double longitude)
Construct a new location from the given data, supplementing any missing information from the static database.
Methods:
- public Location @ref ()
Adds 1 to this's reference count.
- public Location deserialize (Variant serialized)
- public async Location detect_nearest_city (double lat, double lon, Cancellable? cancellable) throws Error
Initializes geocode reversing to find place for (
lat
,lon
) coordinates. - public bool equal (Location two)
Compares two Location and sees if they represent the same place.
- public Location find_by_country_code (string country_code)
Retrieves the country identified by the specified ISO 3166 code, if present in the database.
- public Location find_by_station_code (string station_code)
Retrieves the weather station identifier by
station_code
. - public Location find_nearest_city (double lat, double lon)
Finds the nearest city to the passed latitude and longitude, among the descendants of this.
- public Location find_nearest_city_full (double lat, double lon, owned FilterFunc? func)
Finds the nearest city to the passed latitude and longitude, among the descendants of this.
- public void free_timezones (Timezone zones)
Frees the array of timezones returned by get_timezones.
- public unowned Location[] get_children ()
Gets an array of this's children; this is owned by this and will not remain valid if this is freed.
- public string? get_city_name ()
For a gweather_location_city or gweather_location_detached location, this is equivalent to get_name.
- public unowned string? get_code ()
Gets the METAR station code associated with a gweather_location_weather_station location.
- public void get_coords (out double latitude, out double longitude)
Gets this's coordinates; you must check has_coords before calling this.
- public unowned string? get_country ()
Gets the ISO 3166 country code of this (or null if this is a region- or world-level location)
- public string? get_country_name ()
Gets the country name of loc.
- public double get_distance (Location loc2)
Determines the distance in kilometers between this and
loc2
. - public unowned string get_english_name ()
Gets this's English name.
- public unowned string get_english_sort_name ()
- public LocationLevel get_level ()
Gets this's level, from gweather_location_world, to gweather_location_weather_station.
- public unowned string get_name ()
Gets this's name, localized into the current language.
- public Location? get_parent ()
Gets this's parent location.
- public unowned string get_sort_name ()
- public unowned Timezone? get_timezone ()
Gets the timezone associated with this, if known.
- public unowned string? get_timezone_str ()
Gets the timezone associated with this, if known, as a string.
- public Timezone[] get_timezones ()
Gets an array of all timezones associated with any location under this.
- public bool has_coords ()
Checks if this has valid latitude and longitude.
- public Location? next_child (owned Location? child)
Allows iterating all children.
- public unowned Variant serialize ()
Transforms a Location into a Variant, in a way that calling deserialize will hold an equivalent Location.
- public void unref ()
Subtracts 1 from this's reference count, and frees it if the reference count reaches 0.