I have a vector layer that I need to filter and zoom to extent of the layer whilst the filter is applied. Most of the examples I see only zoom to selected features. I have managed to filter using
p_id = 31
filter_rule = ' id = %s ' % p_id
qExp = QgsExpression(filter_rule)
qReq = QgsFeatureRequest(qExp)
features = layer.getFeatures(qReq)
How can I zoom to the extent to only show the feature which corresponds to the filter?