]> err.no Git - mapper/commitdiff
Handle some more POIs properly
authorKaj-Michael Lang <milang@tal.org>
Mon, 28 Apr 2008 08:39:27 +0000 (11:39 +0300)
committerKaj-Michael Lang <milang@tal.org>
Mon, 28 Apr 2008 08:39:27 +0000 (11:39 +0300)
src/osm-db-import.c
src/osm.h

index 1cfcc1965d73bbaa0c38bc194ec463b928ead604..a274d63c4a0f5e7f389b786b540379af8f9c7fa5 100644 (file)
@@ -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);
 }
 
 /*********************************************************************/
index 82a4b8117e96daab6675e613ddf877cf141c1cda..bce160ea7a1388263abc8ef88ed173b739a9acee 100644 (file)
--- 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,