You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
QgsFeatureRequest could get some love to make it less verbose... but rather than building a wrapper on top of it, maybe better to try to improve existing API...? Something like:
for f in layer.query().filter("x=1").limit(5):
print f
So layer.query() would replace layer.getFeatures(...) and it would just return QgsFeatureRequest initialized to the given layer, which could have further chained method calls. Then we would just make QgsFeatureRequest an iterable class (in both c++ and python).
Possibly the class name of QgsFeatureRequest could be also changed to QgsFeatureQuery ?
On Wed, Dec 7, 2016 at 4:51 PM, Martin Dobias ***@***.***> wrote:
QgsFeatureRequest could get some love to make it less verbose... but
rather than building a wrapper on top of it, maybe better to try to improve
existing API...? Something like:
for f in layer.query().filter("x=1").limit(5):
print f
So layer.query() would replace layer.getFeatures(...) and it would just
return QgsFeatureRequest initialized to the given layer, which could have
further chained method calls. Then we would just make QgsFeatureRequest an
iterable class (in both c++ and python).
Possibly the class name of QgsFeatureRequest could be also changed to
QgsFeatureQuery ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXS3HbNQe7mxB2F_d5KariC4Kejj5Z3ks5rFleBgaJpZM4LGMHk>
.
The layer iterators are fantastic however the API is pretty raw I think a higher level wrapper to make it a bit more approachable would be nice.
Here is an example in Python that I have done in one my projects:
Can be used in line quite nicely in a for loop:
Under the hood this just wraps QgsFeatureRequest and handles any of building:
Compared to:
Python version:
The text was updated successfully, but these errors were encountered: