<div dir="ltr"><div class="gmail_default">Hi, </div><div class="gmail_default"><br></div><div class="gmail_default">This issue just appeared on gis.stackexchange: <a href="http://gis.stackexchange.com/questions/157846/qgis-2-8-how-can-layer-selectedfeatures-return-an-empty-list-while-layer-sel">http://gis.stackexchange.com/questions/157846/qgis-2-8-how-can-layer-selectedfeatures-return-an-empty-list-while-layer-sel</a> </div><div class="gmail_default"><br></div><div class="gmail_default">selectedFeatures() returns an empty list if lots of features are selected.</div><div class="gmail_default"><span class="comment-copy" style="font-size:13px;line-height:16.8999996185303px;margin:0px;padding:0px;border:0px;background-color:rgba(248,248,248,0.6)"><br></span></div><div class="gmail_default"><span class="comment-copy" style="font-size:13px;line-height:16.8999996185303px;margin:0px;padding:0px;border:0px;background-color:rgba(248,248,248,0.6)">I tested with a Spatialite layer and QGIS shows "SQLite error: Expression tree is too large (maximum depth 1000)" in the Spatialite log panel but there is no other indication (i.e. error thrown) of anything going wrong.</span><br></div><div class="gmail_default"><span style="font-size:13px;line-height:16.8999996185303px;background-color:rgba(248,248,248,0.6)"><br></span></div><div class="gmail_default"><span style="font-size:13px;line-height:16.8999996185303px;background-color:rgba(248,248,248,0.6)">Code to reproduce:</span></div><div class="gmail_default"><br><pre class="lang-py prettyprint prettyprinted" style="font-size:13px;margin-top:0px;padding:5px;border:0px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">layer </span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> qgis</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">utils</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">iface</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">activeLayer</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
nbrSelected</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">layer</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">selectedFeatureCount</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
selection01 </span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> layer</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">selectedFeatures</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">()</span></code></pre><p style="font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgba(248,248,248,0.6)">What I've noticed is that if I select <strong style="margin:0px;padding:0px;border:0px">more than 999 features</strong>, nbrSelected still returns the correct number of points, but</p><blockquote style="font-size:15px;margin:0px 0px 10px;padding:10px;border-width:0px;border-left-style:solid;border-left-color:transparent;quotes:none;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(238,238,238)"><p style="margin:0px;padding:0px;border:0px;clear:both">len(selection01)</p></blockquote><p style="font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgba(248,248,248,0.6)">returns 0... the list is empty.</p><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="line-height:17.5499992370605px;background-color:rgba(248,248,248,0.6)">Should I open a ticket? Or is there something I'm missing?</span></font></div><div class="gmail_default"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="line-height:17.5499992370605px;background-color:rgba(248,248,248,0.6)"><br></span></font></div><div class="gmail_default"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="line-height:17.5499992370605px;background-color:rgba(248,248,248,0.6)">Thanks and best wishes,</span></font></div><div class="gmail_default"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="line-height:17.5499992370605px;background-color:rgba(248,248,248,0.6)">Anita</span></font></div><div class="gmail_default"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="line-height:17.5499992370605px;background-color:rgba(248,248,248,0.6)"><br></span></font></div></div>