From: Kaj-Michael Lang Date: Thu, 25 Oct 2007 10:26:32 +0000 (+0300) Subject: Rename s2s table to n2n. Start to make pre-projected integer lat,lon optional. Use... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3333d2415e3ae18ab2899f06b63e5a2dc7d0dc8;p=mapper Rename s2s table to n2n. Start to make pre-projected integer lat,lon optional. Use nodes flags field (0 for now). --- diff --git a/src/osm.c b/src/osm.c index 49a54a0..99de5df 100644 --- a/src/osm.c +++ b/src/osm.c @@ -38,9 +38,19 @@ /* #define VERBOSE */ /* #define VERBOSE_KEYS */ + +/* Use small buffer if run on a tablet */ +#ifdef WITH_DEVICE_770 #define FILE_BUFFER 65535 +#else +#define FILE_BUFFER 524280 +#endif + #define OSM_DB_FILE "osm-planet.db" +/* Store pre-mercator projected integers for lat/lon for nodes */ +#define INTEGER_LATLON + static guint node_cnt=0; static guint node_skip_cnt=0; static guint noded_cnt=0; @@ -196,6 +206,7 @@ struct _nodeinfo { { "place", "island", NODE_PLACE_ISLAND }, { "highway", "traffic_signals", NODE_TRAFFIC_SIGNALS }, + { "highway", "motorway_junction", NODE_JUNCTION }, { "highway", "services", NODE_AMENITY_PARKING }, { "highway", "toll_booth", NODE_TOLLBOOTH }, { "highway", "gate", NODE_GATE }, @@ -341,7 +352,7 @@ void db_prepare(void) { /* Way nodes */ -sqlite3_prepare_v2(db, "insert or replace into nodes (nid,lat,lon,l) values (?, ?, ?, 0)", -1, &sql.insert_node, NULL); +sqlite3_prepare_v2(db, "insert or replace into nodes (nid,lat,lon,l,flags) values (?,?,?,0,?)", -1, &sql.insert_node, NULL); sqlite3_prepare_v2(db, "select lat,lon,l from nodes where nid=?", -1, &sql.select_node, NULL); sqlite3_prepare_v2(db, "delete from nodes", -1, &sql.delete_nodes, NULL); sqlite3_prepare_v2(db, "update nodes set l=l+1 where nid=?", -1, &sql.update_node, NULL); @@ -360,8 +371,8 @@ sqlite3_prepare_v2(db, "insert or replace into way (wid,nodes,type,flags,speed,i sqlite3_prepare_v2(db, "delete from way", -1, &sql.delete_way, NULL); /* Way nodes */ -sqlite3_prepare_v2(db, "insert into way_s2s (wsid,f,t) values (?, ?, ?)", -1, &sql.insert_way_n2n, NULL); -sqlite3_prepare_v2(db, "delete from way_s2s where wsid=?", -1, &sql.delete_way_n2n, NULL); +sqlite3_prepare_v2(db, "insert into way_n2n (wsid,f,t,d) values (?,?,?,?)", -1, &sql.insert_way_n2n, NULL); +sqlite3_prepare_v2(db, "delete from way_n2n where wsid=?", -1, &sql.delete_way_n2n, NULL); /* Way names */ sqlite3_prepare_v2(db, "insert or replace into way_names (wid,name) values (?, ?)", -1, &sql.insert_way_name, NULL); @@ -409,13 +420,21 @@ gboolean db_insert_node(node *n) { gint32 lat, lon; +guint32 flags=0; + +sqlite3_bind_int(sql.insert_node, 1, n->id); +#ifdef INTEGER_LATLON lat=lat2mp_int(n->lat); lon=lon2mp_int(n->lon); - -sqlite3_bind_int(sql.insert_node, 1, n->id); sqlite3_bind_int(sql.insert_node, 2, lat); sqlite3_bind_int(sql.insert_node, 3, lon); +#else +sqlite3_bind_double(sql.insert_node, 2, lat); +sqlite3_bind_double(sql.insert_node, 3, lon); +#endif + +sqlite3_bind_int(sql.insert_node, 4, flags); sqlite3_step(sql.insert_node); sqlite3_reset(sql.insert_node); sqlite3_clear_bindings(sql.insert_node);