<div dir="ltr">Hey Roberto,<div><br></div><div>No need for all that :)</div><div><br></div><div>This is all you need:</div><div><br></div><div>rq = QgsFeatureRequest(iface.mapCanvas().extent())</div><div>for feature in layer.getFeatures(rq):</div>

<div>   ...</div><div><br></div><div><a href="http://www.qgis.org/api/classQgsFeatureRequest.html">http://www.qgis.org/api/classQgsFeatureRequest.html</a><br></div><div><br></div><div>- Nathan</div><div><br></div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Thu, Oct 24, 2013 at 8:11 PM, Geo DrinX <span dir="ltr"><<a href="mailto:geodrinx@gmail.com" target="_blank">geodrinx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div><div>Hello all again,<br><br></div>From PyQgis, I need to export (to my own format) only the elements contained in the QGis view.<br><br></div>So, I taken the canvas coordinates and I created a string that has the "expression" syntax:<br>


<div><br>                text = self.iface.mapCanvas().extent().toString()<br>                text1 = text.replace("," , " ")<br>                text2 = text1.replace(" : ", ",")<br>


                text = "bbox($geometry, geomFromWKT ( 'LINESTRING(" + text2 + ")'))"<br><br><br></div><div>There is a way to applicate the bbox filter during the scanning of the elements, that is during:<br>


<br>                    iter = layer.getFeatures()<br>                    for feat in iter:<br><br></div><div>...or, need I to filter elements from myself ?<br></div><div><br></div><div>It will be only in 2.2 version ?<br>


</div><div class="im"><div><br></div><div>Thank you for any info about this<br></div><div><div class="gmail_extra"><br></div><div class="gmail_extra">Roberto<br></div><div class="gmail_extra"><br><div class="gmail_quote">

<br></div><br></div>
</div></div></div>
<br>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br></blockquote></div><br></div>