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)
/* 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"
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);
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));