Imagine that the lines that i have drawn is simple pipeline network, represented by some simple lines in a vector layer.
How can i define a script that changes the color of only specific lines to "red"?
I tried to write a script from google sources but i failed dramatically. I managed to change the color of the all the lines but i need to specify the "red" color. So far my script is this, but its not working:
from PyQt4.QtGui import * from PyQt4.QtCore import * from qgis.core import * from qgis.utils import iface def change_color(): active_layer = iface.activeLayer() """renderer = active_layer.rendererV2()""" renderer = QgsCategorizedSymbolRendererV2() active_layer.setRendererV2(renderer) symbol = QgsSymbolV2.defaultSymbol(active_layer.geometryType()) symbol.setColor(QColor(Qt.red)) active_layer.setCacheImage(None) iface.mapCanvas().refresh() iface.legendInterface().refreshLayerSymbology(active_layer) change_color()
This is what i am looking for but with a script not manually