]> err.no Git - mapper/commitdiff
Start to handle place isin id #. We still need to handle storing it in osm.c
authorKaj-Michael Lang <milang@angel.tal.org>
Sat, 21 Jul 2007 18:06:23 +0000 (21:06 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Sat, 21 Jul 2007 18:06:23 +0000 (21:06 +0300)
src/map.c
src/osm-db.c
src/osm.h

index 2f092b807699cbdda5096af2c19bc5d0f295d955..f3a3c996e4600ede6cf8c2eb7b65282ae0e8a25f 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1384,7 +1384,11 @@ g_printf("IntPos: %d , %d\n", ilat, ilon);
 
 if (osm_find_nearest_place(NODE_PLACE_SUBURB, ilat, ilon, &splace)==TRUE)
        g_printf("Near suburb: %s\n", splace.name);
-
+if (splace.isin!=0) {
+#if 0
+       osm_get_place(splace.isin, &mplace);
+#endif
+}
 if (osm_find_nearest_place(NODE_PLACE_CITY, ilat, ilon, &mplace)==TRUE)
        g_printf("Near city: %s\n", mplace.name);
 else if (osm_find_nearest_place(NODE_PLACE_TOWN, ilat, ilon, &mplace)==TRUE)
index 62c07ae99dfbed5582b89f84ff5c7a1a9cc9c2e6..3fda99c33d3f144b40cda3216601129ac4544553 100644 (file)
@@ -29,7 +29,7 @@ osm_db_prepare(sqlite3 *db)
 /* Place */
 /* Select nearest place inside lat,lon+-range */
 if (sqlite3_prepare_v2(db, "select name,(($LAT-lat)*($LAT-lat))+(($LON-lon)*($LON-lon)) as dist,"
-                                       " lat,lon,places.nid "
+                                       " lat,lon,places.nid,isin "
                                        " from places,nodes where type=$TYPE "
                                        " and nodes.nid=places.nid "
                                        " and lat between $LAT-$RANGE and $LAT+$RANGE"
@@ -85,11 +85,19 @@ gint range;
 
 switch (type) {
        case NODE_PLACE_SUBURB:
-               range=70000;
+               range=75000;
        break;
-       default:
+       case NODE_PLACE_CITY:
+       case NODE_PLACE_TOWN:
+               range=250000;
+       break;
+       case NODE_PLACE_HAMLET:
+       case NODE_PLACE_VILLAGE:
                range=100000;
        break;
+       default:
+               range=80000;
+       break;
 }
 
 g_assert(n);
@@ -115,6 +123,7 @@ if (SQLITE_ROW == sqlite3_step(sql.select_place)) {
        n->lat=sqlite3_column_int(sql.select_place, 2);
        n->lon=sqlite3_column_int(sql.select_place, 3);
        n->id=sqlite3_column_int(sql.select_place, 4);
+       n->isin=sqlite3_column_int(sql.select_place, 5);
        n->type=type;
 
        g_printf("Place(%d): %s distance: %f\n", type, place, sqrt((float)dist));
index b28a2562837582a0e827d090b9e3f7719aa79c19..a51afe03f68da8c57fbbb4e085224dbad1a78738 100644 (file)
--- a/src/osm.h
+++ b/src/osm.h
@@ -96,6 +96,7 @@ struct _osm_place {
        gint lat;
        gint lon;
        gint dist;
+       guint32 isin;
 };
 
 typedef struct _osm_way osm_way;