<div dir="ltr"><div class="gmail_default"><div class="gmail-m_5271804623627878219gmail-_rp_L4" style="font-family:tahoma,sans-serif"></div> <div class="gmail-m_5271804623627878219gmail-_rp_W4 gmail-m_5271804623627878219gmail-_rp_V4">  <div style="font-family:tahoma,sans-serif"></div>   <div style="font-family:tahoma,sans-serif"></div>  <div style="font-family:tahoma,sans-serif"></div>   <div>      <div class="gmail-m_5271804623627878219gmail-_rp_M4" id="gmail-m_5271804623627878219gmail-Item.MessagePartBody">  <div class="gmail-m_5271804623627878219gmail-_rp_N4 gmail-m_5271804623627878219gmail-ms-font-weight-regular gmail-m_5271804623627878219gmail-ms-font-color-neutralDark gmail-m_5271804623627878219gmail-rpHighlightAllClass gmail-m_5271804623627878219gmail-rpHighlightBodyClass" id="gmail-m_5271804623627878219gmail-Item.MessageUniqueBody"><div class="gmail-m_5271804623627878219gmail-rps_556a">
<div>
<div dir="ltr">
<div id="gmail-m_5271804623627878219gmail-x_divtagdefaultwrapper" dir="ltr">
<p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px"><span style="font-size:10pt">I have a shapefile of buffers "buffer300" of a network  of proposed transmission lines and a polygon file  called "struct" of</span><span style="font-size:13.3333px"> habitable structures. I want to create a column associated with each of the buffers in the "struct" file and populate it with a 1 or 0 to indicate whether or not it intersects that buffer.</span></p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">1.) I can select by attribute like this <span style="font-size:13.3333px">to select feature number 1001 from "buffer300" </span><span style="font-size:13.3333px">:</span></p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px"> buffer300.<wbr>selectByExpression("\"PSI_<wbr>Route\"='1001'")<span style="font-size:13.3333px"> </span></p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px"><span style="font-size:13.3333px">2.)  In order to select by location from "struct" using "buffer300" I tried:</span></p><p><font color="#000000" face="georgia, serif"><span style="font-size:13.3333px">import processing</span></font></p><p></p><p><font color="#000000" face="georgia, serif"><span style="font-size:13.3333px">processing.runalg('qgis:selectbylocation', struct,buffer300,'intersect',0,0)</span></font><br></p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">Which is not working, so I haven't attempted my next step, which will be to select by location using only the selected feature as the reference feature.</p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px"><span style="font-size:13.3333px">My intent is to do this for each buffer, so at the end my "hab_struct" has an attribute for each of the 65 buffers with a 1 or 0 indicating whether or not the feature intersects that particular buffer. I really need to automate this.</span></p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">I could do this logic in pure python no problem, but I'm not familiar with using python in this context. </p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">First things first, can anyone tell me what is wrong with my spatial query?</p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">Secondly, is there a way<span style="font-size:10pt"> to use only the selected feature in a spatial query in the python console (or the graphical modeller for that matter.)</span></p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">Any ideas? </p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">Many thanks,</p><p style="color:rgb(0,0,0);font-family:georgia,serif;font-size:13.3333px">Holly Wilkie</p><div style="color:rgb(0,0,0);font-family:georgia,serif;font-size:10pt"><br></div></div></div></div></div></div></div></div></div></div></div>