Hi mikeE here is a small example based on your code:
uri = 'https://www.geodatenportal.sachsen-anhalt.de/wss/service/ST_LVermGeo_ALKIS_WFS_OpenData/guest?&service=WFS&BBOX=1332412,6708967,1333423,6709355&restrictToRequestBBOX=1&VERSION=auto&typename=ave:GebaeudeBauwerk&srsname=EPSG:25832&preferCoordinatesForWfsT11=false&pagingEnabled=true'
lyr14 = QgsVectorLayer(uri, "LSA: ALKIS Gebäude (WFS)" , 'WFS') # Farbe ändern lyr14.renderer().symbol().setColor(QColor("red")) lyr14.renderer().symbol().symbolLayer(0).setStrokeColor(QColor("blue")) lyr14.renderer().symbol().symbolLayer(0).setStrokeWidth(0.5) #lyr14.triggerRepaint() #braucht es nur wenn schon geladen # Legende updaten iface.layerTreeView().refreshLayerSymbology(lyr14.id()) QgsProject.instance().addMapLayer(lyr14) Am 09.04.2024 um 15:28 schrieb Elstermann, Mike via QGIS-User:
Hello everyone, I have a code snippet to load a WFS, how can I easily change the symbolization (outline color/thickness and fill) using Python in QGIS?. def addWFS14(self): uri = 'https://www.geodatenportal.sachsen-anhalt.de/wss/service/ST_LVermGeo_ALKIS_WFS_OpenData/guest?&service=WFS&BBOX=1332412,6708967,1333423,6709355&restrictToRequestBBOX=1&VERSION=auto&typename=ave:GebaeudeBauwerk&srsname=EPSG:25832&preferCoordinatesForWfsT11=false&pagingEnabled=true' lyr14 = QgsVectorLayer(uri, "LSA: ALKIS Gebäude (WFS)" , ‚WFS') QgsProject.instance().addMapLayer(lyr14) Thanks & best regards, mikeE. _______________________________________________ QGIS-User mailing list QGIS-User@lists.osgeo.org List info:https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
-- Mit freundlichen Grüßen Stefan Giese Projektleiter/Consultant ********************************************* Aufwind durch Wissen! Web-Seminare und Online-Schulungen bei derwww.foss-academy.com ********************************************* WhereGroup GmbH Schwimmbadstr. 2 79100 Freiburg Germany Tel.: +49 (0)761 / 519 102 - 61 Fax: +49 (0)761 / 519 102 - 11 stefan.gi...@wheregroup.com www.wheregroup.com Geschäftsführer: Olaf Knopp, Peter Stamm Amtsgericht Bonn, HRB 9885
_______________________________________________ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user