1

I construct a QgsRubberBand in PyQGIS 2.18.17 the following way

canvas = iface.mapCanvas()
my_rubber = QgsRubberBand(canvas, QGis.WKBPolygon)

according to https://qgis.org/api/2.18/classQgsRubberBand.html

and get a Deprecation Warning like

2018-03-23T11:56:19 1   warning:C:/Users/Jochen/.qgis2/python/plugins\BBBBPlanung\bbbb_planung_dockwidget.py:666: DeprecationWarning: QgsRubberBand constructor is deprecated
          my_rubber = QgsRubberBand(canvas, QGis.WKBPolygon)

Why this?

1

Should have had a deeper look into QGis.GeometryType https://qgis.org/api/2.18/classQGis.html#a09947eb19394302eeeed44d3e81dd74b

According to this

my_rubber = QgsRubberBand(canvas, QGis.Polygon)

is the correct way, and the Deprecation Warning has vanished.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.