Azad Rasul
SmartRS

SmartRS

10- Appearance of Vector Layers

Azad Rasul's photo
Azad Rasul

Published on Jun 25, 2021

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Download the data

Then, load the point type shapefile

uri = "D:/Python_QGIS/data/KRG_Cities.shp"
vlayer = iface.addVectorLayer(uri, "KRG_Cities", "ogr")

Change the size of the circle

vlayer.renderer().symbol().setSize(8)
vlayer.triggerRepaint()

Change the color of the symbol

vlayer.renderer().symbol().setColor(QColor("green"))
vlayer.triggerRepaint()

Change circles to other symbols

vlayer.renderer().symbol().symbolLayer(0).setShape(QgsSimpleMarkerSymbolLayerBase.Pentagon)
vlayer.triggerRepaint()
 
Share this
Proudly part of