Saturday, 7 October 2017

python - Colorify polygons in a pythonic way in Qgis


I want to addd a Layer and give the layer a color for the border and for the filling. With the code below i am possible to achieve a color for the border, but a did not found a solution to give a color for the filling. In addition, is it possible to change the width of the border line?


uri.setDataSource("shema_name", "layer_name", "geom","","layer_name_id")
lyr = QgsVectorLayer(uri.uri(), "layer_name_you_like", "postgres")

props = { 'color_border' : '255,165,0,125', 'style' : 'no', 'style_border' : 'solid' }
s = QgsFillSymbolV2.createSimple(props)
lyr.setRendererV2( QgsSingleSymbolRendererV2( s ) )


QgsMapLayerRegistry.instance().addMapLayer(lyr)


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...