Skip to main content
added 29 characters in body; edited tags; edited title
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

Modify AttributeError when modifying vector layer symbology in QGIS bywith PyQGIS

In QGIS 3.22 I'm facing a problem with QgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. 

This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()
from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash', 'Color': 'red'})
symbol = lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here is the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QGIS 3.22

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

Is there is any solution for that?

Modify symbology in QGIS by PyQGIS

I'm facing a problem with QgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here is the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QGIS 3.22

Is there is any solution for that?

AttributeError when modifying vector layer symbology with PyQGIS

In QGIS 3.22 I'm facing a problem with QgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. 

This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash', 'Color': 'red'})
symbol = lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here is the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

Is there is any solution for that?

I'm facing a problem with QgsMapLayerQgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here it is, the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QGIS 3.22

Is there is any solution for that?

I'm facing a problem with QgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here it is, the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QGIS 3.22

Is there is any solution for that?

I'm facing a problem with QgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here is the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QGIS 3.22

Is there is any solution for that?

naming
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Modify symbology in qgisQGIS by pyqgisPyQGIS

I'm facing a problem with QgsMapLayer ,. I want to use it on qgisQGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of pyqgis ,ThisPyQGIS. This is the script I'm using  :

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here it is, the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QgisQGIS 3.22

Is there is any solution for that?

Modify symbology in qgis by pyqgis

I'm facing a problem with QgsMapLayer , I want to use it on qgis in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of pyqgis ,This is the script I'm using  :

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here it is, the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have Qgis 3.22

Is there is any solution for that?

Modify symbology in QGIS by PyQGIS

I'm facing a problem with QgsMapLayer. I want to use it on QGIS in order to modify the symbology of line, point & polygon in each layer but every time it gives me an error on using the library of PyQGIS. This is the script I'm using:

from PyQt5.QtGui import *
from qgis.core import * 

lyr = QgsVectorLayer("PATH", 'ligne', 'ogr')
QgsProject.instance().addMapLayer(lyr)
sym = QgsLineSymbol.createSimple({'Line_style': 'dash','Color': 'red'})
symbol= lyr.QgsMapLayer.createMapRenderer().symbols(QgsRenderContext())
sym = symbols[0]
lyr.triggerRepaint()

And here it is, the error message:

AttributeError: 'QgsVectorLayer' object has no attribute 'QgsMapLayer'

I have QGIS 3.22

Is there is any solution for that?

added 31 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404
Loading
Source Link
Loading