[Qgis-developer] change to new symbology and set symbol
transparency + color
Michiel Faber
fabermichiel at planet.nl
Mon Jun 20 16:05:31 EDT 2011
Hello all,
Recently i started a new job. I introduced QGis to my collague's and
they where very enthousiastic. I'm encouraged to use QGis instead of
ArcGis.
I wrote a simple script that generates >50 maps (png) automatically from
shapefiles.
But i want to finetune the proces and make the map more appealing.
For this i need to change the symbol transparency. But i haven't found a
way to do it. sym.setTransparency(75) doesn't work.
Furthermore, i want to change the color of the symbols. I can change the
inner part of the symbol, but not the edge. Whatever i do, it stays
yellow (of all colors). The strange thing is that the edge of the
symbols in the legend do change to the color i want (and the color of
the symbols on the legend and map if i want to).
Swapping the lines so renderer.addSymbol is last didn't solve the issue
I believe i am still working with the old symbology as i have not found
a way to move over to the new symbology using PyQgis. In the cookbook is
only a reference to check what you use, not to switch.
A snapshot of the symbol creation:
color = QColor(255*i/numberOfClasses, 255-255*i/numberOfClasses, 0) #
from green to red
sym = QgsSymbol( layer.geometryType(), lower, upper, label, Qt.red )
# why a red edge in legend but not on the map?
renderer.addSymbol( sym )
sym.setFillColor(color)
sym.setPointSize(4)
#sym.setTransparency(75)
On both Qgis 1.7 on ubuntu and Qgis 1.6 on windows xp i get the same
problems.
Regards,
Michiel
More information about the Qgis-developer
mailing list