<div dir="ltr">If you haven't saved the layer after you did the delete the provider still thinks there is 4 features. The layer itself and the edit buffer sit above the data provider. <div><br></div><div>Generally you should trust the layer as it knows the state of the edit buffer.<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 30, 2016 at 10:32 PM, Casper Børgesen (CABO) <span dir="ltr"><<a href="mailto:CABO@niras.dk" target="_blank">CABO@niras.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="DA" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">I have a point SHAPE layer with 4 points on a line (just to make them easy to number in this example, and the layer is created in QGIS).<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p><u></u><span lang="EN-US"><span>1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="color:#1f497d">Start editing.<u></u><u></u></span></p>
<p><u></u><span lang="EN-US"><span>2.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="color:#1f497d">Delete point number 3.<u></u><u></u></span></p>
<p><u></u><span lang="EN-US"><span>3.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="color:#1f497d">In the python console do the following:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">>>> len(list(iface.mapCanvas().<wbr>currentLayer().getFeatures()))<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">3<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">>>> len(list(iface.mapCanvas().<wbr>currentLayer().dataProvider().<wbr>getFeatures()))<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">4<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">>>> req = QgsFeatureRequest()<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">>>> req = req.setLimit(3)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">>>> len(list(iface.mapCanvas().<wbr>currentLayer().getFeatures(<wbr>req)))<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">2<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">>>> len(list(iface.mapCanvas().<wbr>currentLayer().dataProvider().<wbr>getFeatures(req)))<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">3<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">If I access the features using the data provider with no request, I get too many features back. If I use a request when getting features directly from the layer, I get too few features back.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I guess the layer directly gives me the best result, but it chokes when the request is limited.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Who can I trust when getting features during an editing session? Or should I approach this in another way?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards, Casper<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Using QGIS master (d3882d5) in Windows 7, x64<u></u><u></u></span></p>
</div>
</div>

<br>______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br></blockquote></div><br></div></div></div>