## GeocodeLocation

GeocodeLocation — Geocode location object

## Synopsis

    #include <geocode-glib/geocode-glib.h>

    struct              GeocodeLocation;
    struct              GeocodeLocationClass;
    #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);
    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_accuracy       (GeocodeLocation *loc);
    guint64             geocode_location_get_timestamp      (GeocodeLocation *loc);

## Object Hierarchy

      GObject
       +----GeocodeLocation

## Properties

      "accuracy"                 gdouble               : Read / Write
      "description"              gchar*                : Read / Write
      "latitude"                 gdouble               : Read / Write
      "longitude"                gdouble               : Read / Write
      "timestamp"                guint64               : Read

## Description

The GeocodeLocation instance represents a location on earth, with an optional description.

## Details

### struct GeocodeLocation

    struct GeocodeLocation;

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

### struct GeocodeLocationClass

    struct GeocodeLocationClass {
    };

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

### GEOCODE_LOCATION_ACCURACY_UNKNOWN

    #define GEOCODE_LOCATION_ACCURACY_UNKNOWN -1

Constant representing unknown accuracy.

### GEOCODE_LOCATION_ACCURACY_STREET

    #define GEOCODE_LOCATION_ACCURACY_STREET 1000 /* 1 km */

Constant representing street-level accuracy.

### GEOCODE_LOCATION_ACCURACY_CITY

    #define GEOCODE_LOCATION_ACCURACY_CITY 15000 /* 15 km */

Constant representing city-level accuracy.

### GEOCODE_LOCATION_ACCURACY_REGION

    #define GEOCODE_LOCATION_ACCURACY_REGION 50000 /* 50 km */

Constant representing region-level accuracy.

### GEOCODE_LOCATION_ACCURACY_COUNTRY

    #define GEOCODE_LOCATION_ACCURACY_COUNTRY 300000 /* 300 km */

Constant representing country-level accuracy.

### GEOCODE_LOCATION_ACCURACY_CONTINENT

    #define GEOCODE_LOCATION_ACCURACY_CONTINENT 3000000 /* 3000 km */

Constant representing continent-level accuracy.

### geocode_location_new ()

    GeocodeLocation *   geocode_location_new                (gdouble latitude,
                                                             gdouble longitude,
                                                             gdouble accuracy);

Creates a new GeocodeLocation object.

`latitude` : | a valid latitude
`longitude` : | a valid longitude
`accuracy` : | accuracy of location in meters
Returns : | a new GeocodeLocation object. Use `g_object_unref()` when done.

### geocode_location_new_with_description ()

    GeocodeLocation *   geocode_location_new_with_description
                                                            (gdouble latitude,
                                                             gdouble longitude,
                                                             gdouble accuracy,
                                                             const char *description);

Creates a new GeocodeLocation object.

`latitude` : | a valid latitude
`longitude` : | a valid longitude
`accuracy` : | accuracy of location in meters
`description` : | a description for the location
Returns : | a new GeocodeLocation object. Use `g_object_unref()` when done.

### geocode_location_get_distance_from ()

    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.

`loca` : | a GeocodeLocation
`locb` : | a GeocodeLocation
Returns : | a distance in km.

### geocode_location_set_description ()

    void                geocode_location_set_description    (GeocodeLocation *loc,
                                                             const char *description);

Sets the description of `loc` to `description`.

`loc` : | a GeocodeLocation
`description` : | a description for the location

### geocode_location_get_description ()

    const char *        geocode_location_get_description    (GeocodeLocation *loc);

Gets the description of location `loc`.

`loc` : | a GeocodeLocation
Returns : | The description of location `loc`.

### geocode_location_get_latitude ()

    gdouble             geocode_location_get_latitude       (GeocodeLocation *loc);

Gets the latitude of location `loc`.

`loc` : | a GeocodeLocation
Returns : | The latitude of location `loc`.

### geocode_location_get_longitude ()

    gdouble             geocode_location_get_longitude      (GeocodeLocation *loc);

Gets the longitude of location `loc`.

`loc` : | a GeocodeLocation
Returns : | The longitude of location `loc`.

### geocode_location_get_accuracy ()

    gdouble             geocode_location_get_accuracy       (GeocodeLocation *loc);

Gets the accuracy (in meters) of location `loc`.

`loc` : | a GeocodeLocation
Returns : | The accuracy of location `loc`.

### geocode_location_get_timestamp ()

    guint64             geocode_location_get_timestamp      (GeocodeLocation *loc);

Gets the timestamp (in seconds since Epoc) of location `loc`.

`loc` : | a GeocodeLocation
Returns : | The timestamp of location `loc`.

## Property Details

### The `"accuracy"` property

      "accuracy"                 gdouble               : Read / Write

The accuracy of this location in meters.

Allowed values: >= -1

Default value: -1

### The `"description"` property

      "description"              gchar*                : Read / Write

The description of this location.

Default value: NULL

### The `"latitude"` property

      "latitude"                 gdouble               : Read / Write

The latitude of this location in degrees.

Allowed values: [-90,90]

Default value: 0

### The `"longitude"` property

      "longitude"                gdouble               : Read / Write

The longitude of this location in degrees.

Allowed values: [-180,180]

Default value: 0

### The `"timestamp"` property

      "timestamp"                guint64               : Read

A timestamp in seconds since Epoch.

Allowed values: <= G_MAXINT64

Default value: 0