/* #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;
{ "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 },
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);
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);
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);