GeocodeGlib.Location

g GObject.Object GObject.Object GeocodeGlib.Location GeocodeGlib.Location GObject.Object->GeocodeGlib.Location

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (latitude, longitude, accuracy)

class

new_with_description (latitude, longitude, accuracy, description)

equal (b)

get_accuracy ()

get_altitude ()

get_crs ()

get_description ()

get_distance_from (locb)

get_latitude ()

get_longitude ()

get_timestamp ()

set_description (description)

set_from_uri (uri)

to_uri (scheme)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

accuracy

float

r/w

The accuracy of this location in meters

altitude

float

r/w

The altitude of this location in meters

crs

GeocodeGlib.LocationCRS

r/w/co

Coordinate Reference System Identification

description

str

r/w

Description of this location

latitude

float

r/w

The latitude of this location in degrees

longitude

float

r/w

The longitude of this location in degrees

timestamp

int

r/w/co

The timestamp of this location in seconds since Epoch

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class GeocodeGlib.Location(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GeocodeGlib.LocationClass

All the fields in the GeocodeGlib.Location structure are private and should never be accessed directly.

classmethod new(latitude, longitude, accuracy)
Parameters:
  • latitude (float) – a valid latitude

  • longitude (float) – a valid longitude

  • accuracy (float) – accuracy of location in meters

Returns:

a new GeocodeGlib.Location object. Use GObject.Object.unref() when done.

Return type:

GeocodeGlib.Location

Creates a new GeocodeGlib.Location object.

classmethod new_with_description(latitude, longitude, accuracy, description)
Parameters:
  • latitude (float) – a valid latitude

  • longitude (float) – a valid longitude

  • accuracy (float) – accuracy of location in meters

  • description (str) – a description for the location

Returns:

a new GeocodeGlib.Location object. Use GObject.Object.unref() when done.

Return type:

GeocodeGlib.Location

Creates a new GeocodeGlib.Location object.

equal(b)
Parameters:

b (GeocodeGlib.Location) – another location

Returns:

True if the instances are equal, False otherwise

Return type:

bool

Compare two GeocodeGlib.Location instances for equality. This compares all fields and only returns True if the instances are exactly equal. For example, if both locations have the same physical coordinates, but one location has its GeocodeGlib.Location :description property set and the other does not, False will be returned. Similarly, if both locations have the same GeocodeGlib.Location :latitude, GeocodeGlib.Location :longitude and GeocodeGlib.Location :altitude, but a different GeocodeGlib.Location :accuracy or GeocodeGlib.Location :timestamp, False will be returned. Or if both locations have the same:obj:GeocodeGlib.Location :latitude and GeocodeGlib.Location :longitude but a different GeocodeGlib.Location :altitude, False will be returned.

Both instances must be non-None.

New in version 3.23.1.

get_accuracy()
Returns:

The accuracy of location self.

Return type:

float

Gets the accuracy (in meters) of location self.

get_altitude()
Returns:

The altitude of location self.

Return type:

float

Gets the altitude of location self.

get_crs()
Returns:

The CRS of location self.

Return type:

GeocodeGlib.LocationCRS

Gets the Coordinate Reference System Identification of location self.

get_description()
Returns:

The description of location self.

Return type:

str

Gets the description of location self.

get_distance_from(locb)
Parameters:

locb (GeocodeGlib.Location) – a GeocodeGlib.Location

Returns:

a distance in km.

Return type:

float

Calculates the distance in km, along the curvature of the Earth, between 2 locations. Note that altitude changes are not taken into account.

get_latitude()
Returns:

The latitude of location self.

Return type:

float

Gets the latitude of location self.

get_longitude()
Returns:

The longitude of location self.

Return type:

float

Gets the longitude of location self.

get_timestamp()
Returns:

The timestamp of location self.

Return type:

int

Gets the timestamp (in seconds since the Epoch) of location self. See GeocodeGlib.Location :timestamp.

set_description(description)
Parameters:

description (str) – a description for the location

Sets the description of self to description.

set_from_uri(uri)
Parameters:

uri (str) – a URI mapping out a location

Raises:

GLib.Error

Returns:

True on success and False on error.

Return type:

bool

Initialize a GeocodeGlib.Location object with the given uri.

The URI should be in the geo scheme (RFC 5870) which in its simplest form looks like:

  • geo:latitude,longitude

An Android extension to set a description is also supported in the form of:

  • geo:0,0?q=latitude,longitude(description)

to_uri(scheme)
Parameters:

scheme (GeocodeGlib.LocationURIScheme) – the scheme of the requested URI

Returns:

a URI representing the location. The returned string should be freed with GLib.free() when no longer needed.

Return type:

str

Creates a URI representing self in the scheme specified in scheme.

Property Details

GeocodeGlib.Location.props.accuracy
Name:

accuracy

Type:

float

Default Value:

-1.0

Flags:

READABLE, WRITABLE

The accuracy of this location in meters.

GeocodeGlib.Location.props.altitude
Name:

altitude

Type:

float

Default Value:

-1.7976931348623157e+308

Flags:

READABLE, WRITABLE

The altitude of this location in meters.

GeocodeGlib.Location.props.crs
Name:

crs

Type:

GeocodeGlib.LocationCRS

Default Value:

GeocodeGlib.LocationCRS.WGS84

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Coordinate Reference System Identification of this location. Only the value ‘wgs84’ is currently valid.

GeocodeGlib.Location.props.description
Name:

description

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The description of this location.

GeocodeGlib.Location.props.latitude
Name:

latitude

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The latitude of this location in degrees.

GeocodeGlib.Location.props.longitude
Name:

longitude

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The longitude of this location in degrees.

GeocodeGlib.Location.props.timestamp
Name:

timestamp

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

A timestamp in seconds since

Epoch, giving when the location was resolved from an address.

A value of 0 (zero) will be interpreted as the current time.