![]() |
![]() |
![]() |
geocode-glib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <geocode-glib/geocode-glib.h> struct GeocodeLocation; struct GeocodeLocationClass; enum GeocodeLocationURIScheme; enum GeocodeLocationCRS; #define GEOCODE_LOCATION_ALTITUDE_UNKNOWN #define GEOCODE_LOCATION_ACCURACY_UNKNOWN #define GEOCODE_LOCATION_ACCURACY_STREET #define GEOCODE_LOCATION_ACCURACY_CITY #define GEOCODE_LOCATION_ACCURACY_REGION #define GEOCODE_LOCATION_ACCURACY_COUNTRY #define GEOCODE_LOCATION_ACCURACY_CONTINENT GeocodeLocation * geocode_location_new (gdouble latitude
,gdouble longitude
,gdouble accuracy
); GeocodeLocation * geocode_location_new_with_description (gdouble latitude
,gdouble longitude
,gdouble accuracy
,const char *description
); gboolean geocode_location_equal (GeocodeLocation *a
,GeocodeLocation *b
); gboolean geocode_location_set_from_uri (GeocodeLocation *loc
,const char *uri
,GError **error
); char * geocode_location_to_uri (GeocodeLocation *loc
,GeocodeLocationURIScheme scheme
); double geocode_location_get_distance_from (GeocodeLocation *loca
,GeocodeLocation *locb
); void geocode_location_set_description (GeocodeLocation *loc
,const char *description
); const char * geocode_location_get_description (GeocodeLocation *loc
); gdouble geocode_location_get_latitude (GeocodeLocation *loc
); gdouble geocode_location_get_longitude (GeocodeLocation *loc
); gdouble geocode_location_get_altitude (GeocodeLocation *loc
); GeocodeLocationCRS geocode_location_get_crs (GeocodeLocation *loc
); gdouble geocode_location_get_accuracy (GeocodeLocation *loc
); guint64 geocode_location_get_timestamp (GeocodeLocation *loc
);
"accuracy" gdouble : Read / Write "altitude" gdouble : Read / Write "crs" GeocodeLocationCRS : Read / Write / Construct Only "description" gchar* : Read / Write "latitude" gdouble : Read / Write "longitude" gdouble : Read / Write "timestamp" guint64 : Read / Write / Construct Only
The GeocodeLocation instance represents a location on earth, with an optional description.
struct GeocodeLocation;
All the fields in the GeocodeLocation structure are private and should never be accessed directly.
struct GeocodeLocationClass { };
All the fields in the GeocodeLocationClass structure are private and should never be accessed directly.
typedef enum { GEOCODE_LOCATION_URI_SCHEME_GEO = 0 } GeocodeLocationURIScheme;
The URI scheme for this location.
typedef enum { GEOCODE_LOCATION_CRS_WGS84 = 0 } GeocodeLocationCRS;
Coordinate Reference System Identification for a location.
#define GEOCODE_LOCATION_ALTITUDE_UNKNOWN -G_MAXDOUBLE
Constant representing unknown altitude.
#define GEOCODE_LOCATION_ACCURACY_UNKNOWN -1
Constant representing unknown accuracy.
#define GEOCODE_LOCATION_ACCURACY_STREET 1000 /* 1 km */
Constant representing street-level accuracy.
#define GEOCODE_LOCATION_ACCURACY_CITY 15000 /* 15 km */
Constant representing city-level accuracy.
#define GEOCODE_LOCATION_ACCURACY_REGION 50000 /* 50 km */
Constant representing region-level accuracy.
#define GEOCODE_LOCATION_ACCURACY_COUNTRY 300000 /* 300 km */
Constant representing country-level accuracy.
#define GEOCODE_LOCATION_ACCURACY_CONTINENT 3000000 /* 3000 km */
Constant representing continent-level accuracy.
GeocodeLocation * geocode_location_new (gdouble latitude
,gdouble longitude
,gdouble accuracy
);
Creates a new GeocodeLocation object.
|
a valid latitude |
|
a valid longitude |
|
accuracy of location in meters |
Returns : |
a new GeocodeLocation object. Use g_object_unref() when done. |
GeocodeLocation * geocode_location_new_with_description (gdouble latitude
,gdouble longitude
,gdouble accuracy
,const char *description
);
Creates a new GeocodeLocation object.
|
a valid latitude |
|
a valid longitude |
|
accuracy of location in meters |
|
a description for the location |
Returns : |
a new GeocodeLocation object. Use g_object_unref() when done. |
gboolean geocode_location_equal (GeocodeLocation *a
,GeocodeLocation *b
);
Compare two GeocodeLocation 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
"description" property set and the other does not, FALSE
will be returned. Similarly, if both locations have the same
"latitude", "longitude" and
"altitude", but a different "accuracy" or
"timestamp", FALSE
will be returned. Or if both locations
have the same"latitude" and "longitude" but a
different "altitude", FALSE
will be returned.
Both instances must be non-NULL
.
|
a location |
|
another location |
Returns : |
TRUE if the instances are equal, FALSE otherwise |
Since 3.23.1
gboolean geocode_location_set_from_uri (GeocodeLocation *loc
,const char *uri
,GError **error
);
Initialize a GeocodeLocation 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)
|
a GeocodeLocation |
|
a URI mapping out a location |
|
GError for error reporting, or NULL to ignore |
Returns : |
TRUE on success and FALSE on error. |
char * geocode_location_to_uri (GeocodeLocation *loc
,GeocodeLocationURIScheme scheme
);
Creates a URI representing loc
in the scheme specified in scheme
.
|
a GeocodeLocation |
|
the scheme of the requested URI |
Returns : |
a URI representing the location. The returned string should be freed
with g_free() when no longer needed. |
double geocode_location_get_distance_from (GeocodeLocation *loca
,GeocodeLocation *locb
);
Calculates the distance in km, along the curvature of the Earth, between 2 locations. Note that altitude changes are not taken into account.
|
a GeocodeLocation |
|
a GeocodeLocation |
Returns : |
a distance in km. |
void geocode_location_set_description (GeocodeLocation *loc
,const char *description
);
Sets the description of loc
to description
.
|
a GeocodeLocation |
|
a description for the location |
const char * geocode_location_get_description (GeocodeLocation *loc
);
Gets the description of location loc
.
|
a GeocodeLocation |
Returns : |
The description of location loc . |
gdouble geocode_location_get_latitude (GeocodeLocation *loc
);
Gets the latitude of location loc
.
|
a GeocodeLocation |
Returns : |
The latitude of location loc . |
gdouble geocode_location_get_longitude (GeocodeLocation *loc
);
Gets the longitude of location loc
.
|
a GeocodeLocation |
Returns : |
The longitude of location loc . |
gdouble geocode_location_get_altitude (GeocodeLocation *loc
);
Gets the altitude of location loc
.
|
a GeocodeLocation |
Returns : |
The altitude of location loc . |
GeocodeLocationCRS geocode_location_get_crs (GeocodeLocation *loc
);
Gets the Coordinate Reference System Identification of location loc
.
|
a GeocodeLocation |
Returns : |
The CRS of location loc . |
gdouble geocode_location_get_accuracy (GeocodeLocation *loc
);
Gets the accuracy (in meters) of location loc
.
|
a GeocodeLocation |
Returns : |
The accuracy of location loc . |
guint64 geocode_location_get_timestamp (GeocodeLocation *loc
);
Gets the timestamp (in seconds since the Epoch) of location loc
. See
"timestamp".
|
a GeocodeLocation |
Returns : |
The timestamp of location loc . |
"accuracy"
property "accuracy" gdouble : Read / Write
The accuracy of this location in meters.
Allowed values: >= -1
Default value: -1
"altitude"
property "altitude" gdouble : Read / Write
The altitude of this location in meters.
Default value: -1.79769e+308
"crs"
property"crs" GeocodeLocationCRS : Read / Write / Construct Only
The Coordinate Reference System Identification of this location. Only the value 'wgs84' is currently valid.
Default value: GEOCODE_LOCATION_CRS_WGS84
"description"
property "description" gchar* : Read / Write
The description of this location.
Default value: NULL
"latitude"
property "latitude" gdouble : Read / Write
The latitude of this location in degrees.
Allowed values: [-90,90]
Default value: 0
"longitude"
property "longitude" gdouble : Read / Write
The longitude of this location in degrees.
Allowed values: [-180,180]
Default value: 0
"timestamp"
property "timestamp" guint64 : Read / Write / 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.
Allowed values: <= G_MAXLONG64
Default value: 0