
/* Select way near given int lat,lon */
select wid,type,flags,num,nodes,((911084432-lat)*(911084432-lat))+((265542144-lon)*(265542144-lon)) as dist from way,way_seg,nodes where wsid=wid and node=nid and lat between 911084432-10000 and 911084432+10000 and lon between 265542144-10000 and 265542144+10000 order by dist;

/* Select nodes for given way */
select num,lat,lon from way_seg,nodes where wsid=4216626 and node=nid order by num

/* Select ways of specific type inside box */
select wid,flags,num,nodes,((911084432-lat)*(911084432-lat))+((265542144-lon)*(265542144-lon)) as dist from way,way_seg,nodes where wsid=wid and node=nid and lat between 911084432-1000000 and 911084432+1000000 and lon between 265542144-1000000 and 265542144+1000000 and type=1 order by dist;
