From 7d1632a1d7513cc8d9fd013b171dde4cb33c2f69 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 28 Apr 2008 11:39:27 +0300 Subject: [PATCH] Handle some more POIs properly --- src/osm-db-import.c | 40 ++++++++++++++++------------------------ src/osm.h | 6 ++++++ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/osm-db-import.c b/src/osm-db-import.c index 1cfcc19..a274d63 100644 --- a/src/osm-db-import.c +++ b/src/osm-db-import.c @@ -137,6 +137,7 @@ struct _nodeinfo { { "amenity", "bank", NODE_AMENITY_BANK }, { "amenity", "police", NODE_AMENITY_POLICE }, + { "amenity", "speed_trap", NODE_AMENITY_SPEEDCAM }, { "amenity", "speed_camera", NODE_AMENITY_SPEEDCAM }, { "amenity", "speed camera", NODE_AMENITY_SPEEDCAM }, @@ -147,15 +148,15 @@ struct _nodeinfo { { "amenity", "college", NODE_AMENITY_COLLEGE }, { "amenity", "university", NODE_AMENITY_COLLEGE }, - { "amenity", "library", NODE_AMENITY_LIBRARY }, + { "amenity", "library", NODE_AMENITY_LIBRARY }, { "amenity", "townhall", NODE_AMENITY_TOWNHALL }, - { "amenity", "supermarket", NODE_AMENITY_SHOP }, - { "amenity", "shopping_centre", NODE_AMENITY_SHOP }, + { "amenity", "supermarket", NODE_AMENITY_SHOP_SUPERMARKET }, + { "amenity", "shopping_centre", NODE_AMENITY_SHOPPING_CENTER }, { "amenity", "shop", NODE_AMENITY_SHOP }, { "amenity", "shops", NODE_AMENITY_SHOP }, - { "amenity", "shopping", NODE_AMENITY_SHOP }, - { "amenity", "shopping_mall",NODE_AMENITY_SHOP }, + { "amenity", "shopping", NODE_AMENITY_SHOPPING_CENTER }, + { "amenity", "shopping_mall",NODE_AMENITY_SHOPPING_CENTER }, { "amenity", "cycle_shop", NODE_AMENITY_SHOP }, { "amenity", "bike_shop", NODE_AMENITY_SHOP }, { "amenity", "coffee_shop", NODE_AMENITY_SHOP }, @@ -164,11 +165,11 @@ struct _nodeinfo { { "amenity", "tea_shop", NODE_AMENITY_SHOP }, /* Shops */ - { "shop", "supermarket", NODE_AMENITY_SHOP }, + { "shop", "supermarket", NODE_AMENITY_SHOP_SUPERMARKET }, + { "shop", "alcohol", NODE_AMENITY_SHOP_ALCOHOL }, + { "shop", "flowers", NODE_AMENITY_SHOP_FLOWERS }, { "shop", "bakery", NODE_AMENITY_SHOP }, - { "shop", "alcohol", NODE_AMENITY_SHOP }, { "shop", "butcher", NODE_AMENITY_SHOP }, - { "shop", "flowers", NODE_AMENITY_SHOP }, { "shop", "clothing", NODE_AMENITY_SHOP }, { "shop", "souvenir", NODE_AMENITY_SHOP }, { "shop", "bicycles", NODE_AMENITY_SHOP }, @@ -182,6 +183,7 @@ struct _nodeinfo { { "shop", "food", NODE_AMENITY_SHOP }, { "shop", "drinks", NODE_AMENITY_SHOP }, { "shop", "sex", NODE_AMENITY_SHOP_ADULT }, + { "shop", "pharmacy", NODE_AMENITY_PHARMACY }, /* Sport */ @@ -239,6 +241,7 @@ struct _nodeinfo { { "railway", "halt", NODE_RAILWAY_HALT }, { "aeroway", "terminal", NODE_AIRPORT_TERMINAL }, + { "aeroway", "aerodrome", NODE_AIRPORT_TERMINAL }, /* Places */ { "place", "city", NODE_PLACE_CITY }, @@ -558,20 +561,9 @@ return db_exec(db,sql.update_node); static gboolean db_insert_way_n2n(way *w, node *nf, node *nt) { -if (!w) { - g_printf("NULL WAY\n"); - return FALSE; -} - -if (!nf) { - g_printf("NULL NODE 1\n"); - return FALSE; -} - -if (!nt) { - g_printf("NULL NODE 2\n"); - return FALSE; -} +g_return_val_if_fail(w, FALSE); +g_return_val_if_fail(nf, FALSE); +g_return_val_if_fail(nt, FALSE); sqlite3_bind_int(sql.insert_way_n2n, 1, w->id); sqlite3_bind_int(sql.insert_way_n2n, 2, nf->id); @@ -1197,7 +1189,9 @@ static void osm_way_save(way *value, gpointer user_data) { dbway_cnt++; +db_transaction_begin(db); db_insert_way(value); +db_transaction_commit(db); if (dbway_cnt % 15000==0 && dbway_cnt>0) { g_printf("\rWays: %f%% (%u/%u)\n", (((float)dbway_cnt/(float)way_cnt)*100), @@ -1220,9 +1214,7 @@ static gboolean osm_planet_save_ways(void) { g_print("Inserting new ways\n"); -db_transaction_begin(db); g_slist_foreach(osm_ways, osm_way_save, NULL); -return db_transaction_commit(db); } /*********************************************************************/ diff --git a/src/osm.h b/src/osm.h index 82a4b81..bce160e 100644 --- a/src/osm.h +++ b/src/osm.h @@ -97,6 +97,12 @@ typedef enum { NODE_HISTORIC_MUSEUM=340, NODE_HISTORIC_CASTLE=341, + NODE_AMENITY_SHOP_SUPERMARKET=350, + NODE_AMENITY_SHOPPING_CENTER=351, + NODE_AMENITY_SHOP_ALCOHOL=352, + NODE_AMENITY_SHOP_FLOWERS=353, + NODE_AMENITY_SHOP_BAKERY=354, + /* Sport */ NODE_SPORT_CENTER=400, NODE_SPORT_STADIUM=401, -- 2.39.5