From: Kaj-Michael Lang Date: Thu, 1 Nov 2007 01:28:09 +0000 (+0200) Subject: Fixes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=693b46bfa89463b6b825e1c834c2ade3837c2da3;p=mapper Fixes --- diff --git a/src/osm.c b/src/osm.c index 4589603..e6a39af 100644 --- a/src/osm.c +++ b/src/osm.c @@ -62,9 +62,6 @@ #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; @@ -440,7 +437,7 @@ db_prepare(void) { /* 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); @@ -449,8 +446,9 @@ sqlite3_prepare_v2(db, "insert or replace into places (nid,type,name,isin) value 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); @@ -521,17 +519,14 @@ gint32 lat, lon; 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); @@ -1732,6 +1727,7 @@ g_printf("Total nodes %d, POIs: %d and Ways %d.\n", node_cnt, noded_cnt, way_cnt 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();