Gjsify LogoGjsify Logo

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.

record

Hierarchy

  • Location

Index

Constructors

Properties

name: string

Methods

  • 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).

    Parameters

    • serialized: GLib.Variant

      the #GVariant representing the #GWeatherLocation

    Returns GWeather.Location

  • 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.

    Parameters

    • lat: number

      Latitude, in degrees

    • lon: number

      Longitude, in degrees

    • cancellable: Gio.Cancellable

      optional, NULL to ignore

    • callback: AsyncReadyCallback

      callback function for GAsyncReadyCallback argument for GAsyncResult

    Returns void

  • 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.

    Parameters

    Returns boolean

  • Retrieves the country identified by the specified ISO 3166 code, if present in the database.

    Prior to version 40 no reference was returned.

    Parameters

    • country_code: string

      a country code

    Returns GWeather.Location

  • 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.

    Parameters

    • station_code: string

      a 4 letter METAR code

    Returns GWeather.Location

  • 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.

    Parameters

    • lat: number

      Latitude, in degrees

    • lon: number

      Longitude, in degrees

    Returns GWeather.Location

  • 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: number

      Latitude, in degrees

    • lon: number

      Longitude, in degrees

    • func: GWeather.FilterFunc

      returns true to continue check for the location and false to filter the location out

    Returns GWeather.Location

  • get_city_name(): string
  • 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.

    Returns string

  • get_code(): string
  • get_coords(): [number, number]
  • get_country(): string
  • get_country_name(): string
  • 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.

    Returns string

  • get_english_name(): string
  • get_english_sort_name(): string
  • 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.

    Returns string

  • get_name(): string
  • get_sort_name(): string
  • 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.

    Returns string

  • get_timezone_str(): string
  • 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.

    Returns string

  • has_coords(): boolean
  • 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
    }

    Parameters

    Returns GWeather.Location

  • 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.

    Returns GLib.Variant

  • unref(): void
  • Obtains the shared #GWeatherLocation of type %GWEATHER_LOCATION_WORLD, representing a hierarchy containing all of the locations from Locations.xml.

    Prior to version 40 no reference was returned.

    Returns GWeather.Location

  • new_detached(name: string, icao: string, latitude: number, longitude: number): GWeather.Location
  • Construct a new location from the given data, supplementing any missing information from the static database.

    Parameters

    • name: string

      the user visible location name

    • icao: string

      the ICAO code of the location

    • latitude: number

      the latitude of the location

    • longitude: number

      the longitude of the location

    Returns GWeather.Location

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method