I have township polygons on a first layer and landmark points on a second layer.
I would like change the color of each township polygons when landmarks points are missing.
I can already select one polygon according its code think to the following script :
import processing layer = processing.getObject('township') query = '"code" = 99 ' selection = layer.getFeatures(QgsFeatureRequest().setFilterExpression(query)) layer.setSelectedFeatures([k.id() for k in selection])
I can also change the color of all polygons :
symbols = layer.rendererV2().symbols() symbol = symbols symbol.setColor(QColor("orange")) qgis.utils.iface.mapCanvas().refresh() qgis.utils.iface.legendInterface().refreshLayerSymbology(layer)
The attribute table of landmark layer contains the numero , geometry and township's code for each mark. Unfortanutaly some geometries are missing !
I need help to make a final script on PyQgis to change the color of only township polygons without landmarks geometry.