[geocode-glib] forward: switch to jsonv2 to include place_type
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib] forward: switch to jsonv2 to include place_type
- Date: Tue, 4 Feb 2014 11:00:29 +0000 (UTC)
commit 49ba62cf6402c948a1b3651b4753f6c30a363dc5
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Sun Feb 2 11:38:56 2014 +0100
forward: switch to jsonv2 to include place_type
The json format does not include the place_rank attribute.
The place_rank attribute is needed to establish what kind of
boundary we are dealing with.
Switching to jsonv2 gives us the place_rank at the cost of having
to rename the class attribute as category.
This patch also fix a typo where boundary was spelled
as boundry. Ensuring that the missing place_rank attribute
never was detected. If fixed in a stand alone patch it exposes
us to a commit that introduces a segfault.
https://bugzilla.gnome.org/show_bug.cgi?id=723463
geocode-glib/geocode-forward.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/geocode-glib/geocode-forward.c b/geocode-glib/geocode-forward.c
index c4a65bf..42c1738 100644
--- a/geocode-glib/geocode-forward.c
+++ b/geocode-glib/geocode-forward.c
@@ -469,7 +469,7 @@ get_search_query_for_params (GeocodeForward *forward,
/* Prepare the query parameters */
ht = _geocode_glib_dup_hash_table (forward->priv->ht);
- g_hash_table_insert (ht, (gpointer) "format", (gpointer) "json");
+ g_hash_table_insert (ht, (gpointer) "format", (gpointer) "jsonv2");
g_hash_table_insert (ht, (gpointer) "email", (gpointer) "zeeshanak gnome org");
g_hash_table_insert (ht, (gpointer) "addressdetails", (gpointer) "1");
@@ -666,13 +666,13 @@ static const char const *attributes[] = {
static GeocodePlaceType
get_place_type_from_attributes (GHashTable *ht)
{
- char *class, *type;
+ char *category, *type;
GeocodePlaceType place_type = GEOCODE_PLACE_TYPE_UNKNOWN;
- class = g_hash_table_lookup (ht, "class");
+ category = g_hash_table_lookup (ht, "category");
type = g_hash_table_lookup (ht, "type");
- if (g_strcmp0 (class, "place") == 0) {
+ if (g_strcmp0 (category, "place") == 0) {
if (g_strcmp0 (type, "house") == 0 ||
g_strcmp0 (type, "building") == 0 ||
g_strcmp0 (type, "residential") == 0 ||
@@ -714,19 +714,19 @@ get_place_type_from_attributes (GHashTable *ht)
place_type = GEOCODE_PLACE_TYPE_SEA;
else if (g_strcmp0 (type, "ocean") == 0)
place_type = GEOCODE_PLACE_TYPE_OCEAN;
- } else if (g_strcmp0 (class, "highway") == 0) {
+ } else if (g_strcmp0 (category, "highway") == 0) {
if (g_strcmp0 (type, "motorway") == 0)
place_type = GEOCODE_PLACE_TYPE_MOTORWAY;
else if (g_strcmp0 (type, "bus_stop") == 0)
place_type = GEOCODE_PLACE_TYPE_BUS_STOP;
else
place_type = GEOCODE_PLACE_TYPE_STREET;
- } else if (g_strcmp0 (class, "railway") == 0) {
+ } else if (g_strcmp0 (category, "railway") == 0) {
if (g_strcmp0 (type, "station") == 0)
place_type = GEOCODE_PLACE_TYPE_RAILWAY_STATION;
- } else if (g_strcmp0 (class, "waterway") == 0) {
+ } else if (g_strcmp0 (category, "waterway") == 0) {
place_type = GEOCODE_PLACE_TYPE_DRAINAGE;
- } else if (g_strcmp0 (class, "boundry") == 0) {
+ } else if (g_strcmp0 (category, "boundary") == 0) {
if (g_strcmp0 (type, "administrative") == 0) {
int rank;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]