[Qgis-developer] python plugins - how to subset a layer

Ricardo Filipe Soares Garcia da ricardo.garcia.silva at gmail.com
Sun Dec 6 14:52:24 EST 2009

Hello list
I have been given a university assignment of applying Furnas's DOI[1]
function in a GIS. I'd like to do this as a Qgis plugin :)
The plugin will basicly perform some filtering on the visibility of
the features that get displayed on the map canvas, according to a
defined Degree of Interest Function. This function combines an A
Priori Interest function for each feature, as well as a distance
function, that will probably be based on the last mouse click over the

I am still just trying to wrap my head around this task, but have
started to explore the Qgis API.

I'd like to ask some questions:

1 - Can I subset a vector layer so that only some features get loaded?
What I mean is using the same kind of functionality that the "subset"
text area on the "general" tab of the "layer properties" dialog
allows. I have searched the API for something like this, but couldn't
find it. Maybe I'm not well familiarized with it yet. can someone
point me to the right classes/methods?

2 - Alternatively, can I selectively hide some features from the
canvas? I have seen that there is a class called QgsFeatureRendererV2
that has a renderFeature member function. Will I be able to use this
through the python plugins interface?

I hope my plugin turns out to be not very crappy and that I can
release it to the world!

Thanks for your help

[1] - http://www.google.pt/url?sa=t&source=web&ct=res&cd=1&ved=0CAcQFjAA&url=https%3A%2F%2Fwiki.cc.gatech.edu%2Fccg%2F_media%2Fclasses%2Fhcisem%2Ffisheyechi86.pdf%3Fid%3Dclasses%253Ahcisem%253Ahome%26cache%3Dcache&ei=nAUcS9jLCpT-4Ab13vj5Ag&usg=AFQjCNFLzOPiK6xVD8acAT9fVlgPZRmLwg&sig2=6U_adStSA3I8douhRbztNg

___________________________ ___ __
Ricardo Garcia Silva

More information about the Qgis-developer mailing list