geocode-glib

geocode-glib — Geocode glib main functions

Synopsis

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

struct              GeocodeObject;
struct              GeocodeObjectClass;
                    GeocodeObjectPrivate;
#define             GEOCODE_OBJECT_FIELD_LONGITUDE
#define             GEOCODE_OBJECT_FIELD_LATITUDE
#define             GEOCODE_OBJECT_FIELD_RADIUS
#define             GEOCODE_OBJECT_FIELD_TIMEZONE
#define             GEOCODE_OBJECT_FIELD_CITY
#define             GEOCODE_OBJECT_FIELD_COUNTRY
#define             GEOCODE_OBJECT_FIELD_AIRPORT
#define             GEOCODE_OBJECT_FIELD_UZIP
#define             GEOCODE_OBJECT_FIELD_COUNTRYCODE
#define             GEOCODE_OBJECT_FIELD_NAME
#define             GEOCODE_OBJECT_FIELD_LINE1
#define             GEOCODE_OBJECT_FIELD_LINE2
#define             GEOCODE_OBJECT_FIELD_LINE3
#define             GEOCODE_OBJECT_FIELD_LINE4
#define             GEOCODE_OBJECT_FIELD_HOUSE
#define             GEOCODE_OBJECT_FIELD_STREET
#define             GEOCODE_OBJECT_FIELD_POSTAL
#define             GEOCODE_OBJECT_FIELD_NEIGHBORHOOD
#define             GEOCODE_OBJECT_FIELD_COUNTY
#define             GEOCODE_OBJECT_FIELD_HASH
#define             GEOCODE_OBJECT_FIELD_STATECODE
#define             GEOCODE_OBJECT_FIELD_STATE
#define             GEOCODE_OBJECT_FIELD_COUNTYCODE
#define             GEOCODE_OBJECT_FIELD_OFFSETLAT
#define             GEOCODE_OBJECT_FIELD_OFFSETLON
GeocodeObject *     geocode_object_new                  (void);
GeocodeObject *     geocode_object_new_for_params       (GHashTable *params);
GeocodeObject *     geocode_object_new_for_coords       (gdouble latitude,
                                                         gdouble longitude);
void                geocode_object_add                  (GeocodeObject *object,
                                                         const char *key,
                                                         const char *value);
void                geocode_object_resolve_async        (GeocodeObject *object,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GHashTable *        geocode_object_resolve_finish       (GeocodeObject *object,
                                                         GAsyncResult *res,
                                                         GError **error);
GHashTable *        geocode_object_resolve              (GeocodeObject *object,
                                                         GError **error);
gboolean            geocode_object_get_coords           (GHashTable *results,
                                                         gdouble *longitude,
                                                         gdouble *latitude);

Object Hierarchy

  GObject
   +----GeocodeObject

Description

Contains functions for geocoding and reverse geocoding using the Yahoo! Place Finder APIs.

Details

struct GeocodeObject

struct GeocodeObject;

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


struct GeocodeObjectClass

struct GeocodeObjectClass {
	GObjectClass parent_class;
};


GeocodeObjectPrivate

typedef struct _GeocodeObjectPrivate GeocodeObjectPrivate;


GEOCODE_OBJECT_FIELD_LONGITUDE

#define GEOCODE_OBJECT_FIELD_LONGITUDE		"longitude"

Metadata field for a result, representing the longitude at the center of the matched area.


GEOCODE_OBJECT_FIELD_LATITUDE

#define GEOCODE_OBJECT_FIELD_LATITUDE		"latitude"

Metadata field for a result, representing the latitude at the center of the matched area.


GEOCODE_OBJECT_FIELD_RADIUS

#define GEOCODE_OBJECT_FIELD_RADIUS		"radius"

Metadata field for a result, representing the radius of the matched area in meters.


GEOCODE_OBJECT_FIELD_TIMEZONE

#define GEOCODE_OBJECT_FIELD_TIMEZONE		"timezone"

Metadata field for a result, representing the timezone of the matched area.


GEOCODE_OBJECT_FIELD_CITY

#define GEOCODE_OBJECT_FIELD_CITY		"city"

Metadata field for a result, representing the city of the matched area.


GEOCODE_OBJECT_FIELD_COUNTRY

#define GEOCODE_OBJECT_FIELD_COUNTRY		"country"

Metadata field for a result, representing the country of the matched area.


GEOCODE_OBJECT_FIELD_AIRPORT

#define GEOCODE_OBJECT_FIELD_AIRPORT		"airport"

Metadata field for a result, representing the closest airport to the matched area.


GEOCODE_OBJECT_FIELD_UZIP

#define GEOCODE_OBJECT_FIELD_UZIP		"uzip"

Metadata field for a result, representing the unique zip code (or postal code) for the matched area.


GEOCODE_OBJECT_FIELD_COUNTRYCODE

#define GEOCODE_OBJECT_FIELD_COUNTRYCODE "countrycode"

Metadata field for a result, representing the country code of the matched area.


GEOCODE_OBJECT_FIELD_NAME

#define GEOCODE_OBJECT_FIELD_NAME		"name"

Metadata field for a result, representing the name of the matched area.


GEOCODE_OBJECT_FIELD_LINE1

#define GEOCODE_OBJECT_FIELD_LINE1		"line1"

Metadata field for a result, representing the line1 of the matched area.


GEOCODE_OBJECT_FIELD_LINE2

#define GEOCODE_OBJECT_FIELD_LINE2		"line2"

Metadata field for a result, representing the line2 of the matched area.


GEOCODE_OBJECT_FIELD_LINE3

#define GEOCODE_OBJECT_FIELD_LINE3		"line3"

Metadata field for a result, representing the line3 of the matched area.


GEOCODE_OBJECT_FIELD_LINE4

#define GEOCODE_OBJECT_FIELD_LINE4		"line4"

Metadata field for a result, representing the line4 of the matched area.


GEOCODE_OBJECT_FIELD_HOUSE

#define GEOCODE_OBJECT_FIELD_HOUSE		"house"

Metadata field for a result, representing the house of the matched area.


GEOCODE_OBJECT_FIELD_STREET

#define GEOCODE_OBJECT_FIELD_STREET		"street"

Metadata field for a result, representing the street of the matched area.


GEOCODE_OBJECT_FIELD_POSTAL

#define GEOCODE_OBJECT_FIELD_POSTAL		"postal"

Metadata field for a result, representing the postal of the matched area.


GEOCODE_OBJECT_FIELD_NEIGHBORHOOD

#define GEOCODE_OBJECT_FIELD_NEIGHBORHOOD "neighborhood"

Metadata field for a result, representing the neighborhood of the matched area.


GEOCODE_OBJECT_FIELD_COUNTY

#define GEOCODE_OBJECT_FIELD_COUNTY		"county"

Metadata field for a result, representing the county of the matched area.


GEOCODE_OBJECT_FIELD_HASH

#define GEOCODE_OBJECT_FIELD_HASH		"hash"

Metadata field for a result, representing the hash of the matched area.


GEOCODE_OBJECT_FIELD_STATECODE

#define GEOCODE_OBJECT_FIELD_STATECODE		"statecode"

Metadata field for a result, representing the statecode of the matched area.


GEOCODE_OBJECT_FIELD_STATE

#define GEOCODE_OBJECT_FIELD_STATE		"state"

Metadata field for a result, representing the state of the matched area.


GEOCODE_OBJECT_FIELD_COUNTYCODE

#define GEOCODE_OBJECT_FIELD_COUNTYCODE		"countycode"

Metadata field for a result, representing the county code of the matched area.


GEOCODE_OBJECT_FIELD_OFFSETLAT

#define GEOCODE_OBJECT_FIELD_OFFSETLAT		"offsetlat"

Metadata field for a result, representing the latitude of the offset point in degrees, representing building/parcel setback from road center-line for the matched area.


GEOCODE_OBJECT_FIELD_OFFSETLON

#define GEOCODE_OBJECT_FIELD_OFFSETLON		"offsetlon"

Metadata field for a result, representing the longitude the offset point in degrees, representing building/parcel setback from road center-line for the matched area.


geocode_object_new ()

GeocodeObject *     geocode_object_new                  (void);

Creates a new GeocodeObject to perform geocoding with. Use geocode_object_add() to add new parameters, and geocode_object_resolve_async() to perform the resolution.

Returns :

a new GeocodeObject. Use g_object_unref() when done.

geocode_object_new_for_params ()

GeocodeObject *     geocode_object_new_for_params       (GHashTable *params);

Creates a new GeocodeObject to perform geocoding with. The GHashTable is in the format used by Telepathy, and documented on Telepathy's specification site.

See also: XEP-0080 specification.

params :

a GHashTable with string keys, and GValue values.

Returns :

a new GeocodeObject. Use g_object_unref() when done.

geocode_object_new_for_coords ()

GeocodeObject *     geocode_object_new_for_coords       (gdouble latitude,
                                                         gdouble longitude);

Creates a new GeocodeObject to perform reverse geocoding with. Use geocode_object_resolve_async() to perform the resolution.

latitude :

a valid latitude

longitude :

a valid longitude

Returns :

a new GeocodeObject. Use g_object_unref() when done.

geocode_object_add ()

void                geocode_object_add                  (GeocodeObject *object,
                                                         const char *key,
                                                         const char *value);

Adds parameters to pass to the web service. A copy of the key and value parameters are kept internally.

object :

a GeocodeObject

key :

a string representing a parameter to the web service

value :

a string representing the value of a parameter

geocode_object_resolve_async ()

void                geocode_object_resolve_async        (GeocodeObject *object,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Asynchronously gets the result of a geocoding or reverse geocoding query using a web service. Use geocode_object_resolve() to do the same thing synchronously.

When the operation is finished, callback will be called. You can then call geocode_object_resolve_finish() to get the result of the operation.

object :

a GeocodeObject representing a query

cancellable :

optional GCancellable object, NULL to ignore.

callback :

a GAsyncReadyCallback to call when the request is satisfied

user_data :

the data to pass to callback function

geocode_object_resolve_finish ()

GHashTable *        geocode_object_resolve_finish       (GeocodeObject *object,
                                                         GAsyncResult *res,
                                                         GError **error);

Finishes a query operation. See geocode_object_resolve_async().

object :

a GeocodeObject representing a query

res :

a GAsyncResult.

error :

a GError.

Returns :

a GHashTable containing the results of the query or NULL in case of errors. Free the returned string with g_hash_table_destroy() when done. [element-type utf8 utf8][transfer full]

geocode_object_resolve ()

GHashTable *        geocode_object_resolve              (GeocodeObject *object,
                                                         GError **error);

Gets the result of a geocoding or reverse geocoding query using a web service.

object :

a GeocodeObject representing a query

error :

a GError

Returns :

a GHashTable containing the results of the query or NULL in case of errors. Free the returned string with g_hash_table_destroy() when done. [element-type utf8 utf8][transfer full]

geocode_object_get_coords ()

gboolean            geocode_object_get_coords           (GHashTable *results,
                                                         gdouble *longitude,
                                                         gdouble *latitude);

Parses the results hashtable and exports the longitude and latitude as gdoubles.

results :

a GHashTable as generated by geocode_object_resolve() and geocode_object_resolve_async()

longitude :

a pointer to a gdouble

latitude :

a pointer to a gdouble

Returns :

TRUE when the longitude and latitude have been found and the return parameters set.