#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;
{
/* Way nodes */
sqlite3_prepare_v2(db, "insert or replace into nodes (nid,ilat,ilon,rlat,rlon,l,f) 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, "select ilat,ilon,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 places", -1, &sql.delete_place, NULL);
/* POI nodes */
-sqlite3_prepare_v2(db, "insert or replace into poi (osm_id, lat, lon, label, cat_id, public, source, priority, isin_c, isin_p, desc, url, postal_code) "
- " values (?, ?, ?, ?, ?, 1, 1, ?, ?, ?, ?, ?, ?)", -1, &sql.insert_poi, NULL);
+if (sqlite3_prepare_v2(db, "insert or replace into poi (osm_id, lat, lon, label, cat_id, public, source, priority, isin_c, isin_p, desc, url, postal_code) "
+ " values (?, ?, ?, ?, ?, 1, 1, ?, ?, ?, ?, ?, ?)", -1, &sql.insert_poi, NULL)!=SQLITE_OK)
+ g_printf("SQL: %s\n", sqlite3_errmsg(db));
sqlite3_prepare_v2(db, "delete from poi where osm_id>0 and source=1", -1, &sql.delete_osm_poi, NULL);
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, 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_double(sql.insert_node, 4, n->lat);
+sqlite3_bind_double(sql.insert_node, 5, n->lon);
+sqlite3_bind_int(sql.insert_node, 6, n->type);
-sqlite3_bind_int(sql.insert_node, 4, n->type);
sqlite3_step(sql.insert_node);
sqlite3_reset(sql.insert_node);
sqlite3_clear_bindings(sql.insert_node);
g_printf("Cities/Towns: %d\n", g_hash_table_size(osm_place_city));
g_printf("Villages/Hamlets: %d\n", g_hash_table_size(osm_place_village));
g_printf("Suburbs: %d\n", g_hash_table_size(osm_place_suburb));
+g_printf("Nodes: %d\n", g_hash_table_size(osm_nodes));
osm_planet_save_all_nodes();
osm_planet_save_all_ways();