/* Place */
/* Select nearest place inside lat,lon+-range */
if (sqlite3_prepare_v2(db, "select name,(($LAT-ilat)*($LAT-ilat))+(($LON-ilon)*($LON-ilon)) as dist,"
- " ilat,ilon,places.nid,isin "
+ " ilat,ilon,places.nid,isin_p,isin_c "
" from places,nodes where type=$TYPE "
" and nodes.nid=places.nid "
" and ilat between $LAT-$RANGE and $LAT+$RANGE"
return FALSE;
/* Select place name, distance, location, parent-place and type with given ID */
-if (sqlite3_prepare_v2(db, "select name,(($LAT-lat)*($LAT-lat))+(($LON-lon)*($LON-lon)) as dist,"
- " lat,lon,type,isin "
+if (sqlite3_prepare_v2(db, "select name,(($LAT-ilat)*($LAT-ilat))+(($LON-ilon)*($LON-ilon)) as dist,"
+ " ilat,ilon,type,isin_p,isin_c "
" from places,nodes where "
" nodes.nid=places.nid "
" and places.nid=$NID order by dist limit 1",
/* Ways */
/* Select nearest ways inside lat,lon+-range */
-if (sqlite3_prepare_v2(db, "select wid,type,nodes,flags,"
- "(($LAT-n.lat)*($LAT-n.lat))+(($LON-n.lon)*($LON-n.lon)) as d,wn.f,wn.t,n.lat,n.lon "
+if (sqlite3_prepare_v2(db, "select w.wid,type,nodes,flags,"
+ "(($LAT-n.ilat)*($LAT-n.ilat))+(($LON-n.ilon)*($LON-n.ilon)) as d,wn.f,wn.t,n.ilat,n.ilon "
" from way as w,way_n2n as wn,nodes as n "
- " where w.wid=wn.wsid and wn.f=n.nid "
- " and n.lat between $LAT-$RANGE and $LAT+$RANGE "
- " and n.lon between $LON-$RANGE and $LON+$RANGE "
+ " where w.wid=wn.wid and wn.f=n.nid "
+ " and n.ilat between $LAT-$RANGE and $LAT+$RANGE "
+ " and n.ilon between $LON-$RANGE and $LON+$RANGE "
" and w.type between $WTS and $WTY "
" order by d",
-1, &sql.select_way2, NULL)!=SQLITE_OK)
" and ww.lon between $LON-$RANGE and $LON+$RANGE "
" union "
" select w.wid,n.name as name,"
- "(($LAT-ww.lat)*($LAT-ww.lat))+(($LON-ww.lon)*($LON-w.lon)) as d,ww.lat,ww.lon "
+ "(($LAT-ww.lat)*($LAT-ww.lat))+(($LON-ww.lon)*($LON-ww.lon)) as d,ww.lat,ww.lon "
" from way_names as w, way as ww,way_names_nls as n on w.wid=n.wid where "
" ww.type between $WTS and $WTY and w.wid=ww.wid and n.name like $NAME "
" and ww.lat between $LAT-$RANGE and $LAT+$RANGE "
-1, &sql.select_way_name_search, NULL)!=SQLITE_OK)
return FALSE;
-if (sqlite3_prepare_v2(db, "select wn.t,lat,lon from way_n2n as wn,nodes where wsid=? and wn.f=? and wn.t=nodes.nid limit 1",
+if (sqlite3_prepare_v2(db, "select wn.t,ilat,ilon from way_n2n as wn,nodes where wid=? and wn.f=? and wn.t=nodes.nid limit 1",
-1, &sql.select_way_next_seg, NULL)!=SQLITE_OK)
return FALSE;
-if (sqlite3_prepare_v2(db, "select wn.f,lat,lon from way_n2n as wn,nodes where wsid=? and wn.t=? and wn.f=nodes.nid limit 1",
+if (sqlite3_prepare_v2(db, "select wn.f,ilat,ilon from way_n2n as wn,nodes where wid=? and wn.t=? and wn.f=nodes.nid limit 1",
-1, &sql.select_way_prev_seg, NULL)!=SQLITE_OK)
return FALSE;