本文整理汇总了Python中qgis.core.QgsUnitTypes类的典型用法代码示例。如果您正苦于以下问题:Python QgsUnitTypes类的具体用法?Python QgsUnitTypes怎么用?Python QgsUnitTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QgsUnitTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ExpressionFieldEllipsoidAreaCalculation
def test_ExpressionFieldEllipsoidAreaCalculation(self):
#create a temporary layer
temp_layer = QgsVectorLayer("Polygon?crs=epsg:3111&field=pk:int", "vl", "memory")
self.assertTrue(temp_layer.isValid())
f1 = QgsFeature(temp_layer.dataProvider().fields(), 1)
f1.setAttribute("pk", 1)
f1.setGeometry(QgsGeometry.fromPolygon([[QgsPoint(2484588, 2425722), QgsPoint(2482767, 2398853), QgsPoint(2520109, 2397715), QgsPoint(2520792, 2425494), QgsPoint(2484588, 2425722)]]))
temp_layer.dataProvider().addFeatures([f1])
# set project CRS and ellipsoid
srs = QgsCoordinateReferenceSystem(3111, QgsCoordinateReferenceSystem.EpsgCrsId)
QgsProject.instance().writeEntry("SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4())
QgsProject.instance().writeEntry("SpatialRefSys", "/ProjectCRSID", srs.srsid())
QgsProject.instance().writeEntry("SpatialRefSys", "/ProjectCrs", srs.authid())
QgsProject.instance().writeEntry("Measure", "/Ellipsoid", "WGS84")
QgsProject.instance().writeEntry("Measurement", "/AreaUnits", QgsUnitTypes.encodeUnit(QgsUnitTypes.SquareMeters))
idx = temp_layer.addExpressionField('$area', QgsField('area', QVariant.Double)) # NOQA
# check value
f = temp_layer.getFeatures().next()
expected = 1009089817.0
self.assertAlmostEqual(f['area'], expected, delta=1.0)
# change project area unit, check calculation respects unit
QgsProject.instance().writeEntry("Measurement", "/AreaUnits", QgsUnitTypes.encodeUnit(QgsUnitTypes.SquareMiles))
f = temp_layer.getFeatures().next()
expected = 389.6117565069
self.assertAlmostEqual(f['area'], expected, 3)
示例2: testEncodeDecodeAreaUnits
def testEncodeDecodeAreaUnits(self):
"""Test encoding and decoding area units"""
units = [QgsUnitTypes.AreaSquareMeters,
QgsUnitTypes.AreaSquareKilometers,
QgsUnitTypes.AreaSquareFeet,
QgsUnitTypes.AreaSquareYards,
QgsUnitTypes.AreaSquareMiles,
QgsUnitTypes.AreaHectares,
QgsUnitTypes.AreaAcres,
QgsUnitTypes.AreaSquareNauticalMiles,
QgsUnitTypes.AreaSquareDegrees,
QgsUnitTypes.AreaSquareCentimeters,
QgsUnitTypes.AreaSquareMillimeters,
QgsUnitTypes.AreaUnknownUnit]
for u in units:
res, ok = QgsUnitTypes.decodeAreaUnit(QgsUnitTypes.encodeUnit(u))
assert ok
self.assertEqual(res, u)
# Test decoding bad units
res, ok = QgsUnitTypes.decodeAreaUnit('bad')
self.assertFalse(ok)
self.assertEqual(res, QgsUnitTypes.AreaUnknownUnit)
# Test that string is cleaned before decoding
res, ok = QgsUnitTypes.decodeAreaUnit(' Ha ')
assert ok
self.assertEqual(res, QgsUnitTypes.AreaHectares)
示例3: testAreaUnitsToFromString
def testAreaUnitsToFromString(self):
"""Test converting area units to and from translated strings"""
units = [QgsUnitTypes.AreaSquareMeters,
QgsUnitTypes.AreaSquareKilometers,
QgsUnitTypes.AreaSquareFeet,
QgsUnitTypes.AreaSquareYards,
QgsUnitTypes.AreaSquareMiles,
QgsUnitTypes.AreaHectares,
QgsUnitTypes.AreaAcres,
QgsUnitTypes.AreaSquareNauticalMiles,
QgsUnitTypes.AreaSquareDegrees,
QgsUnitTypes.AreaSquareCentimeters,
QgsUnitTypes.AreaSquareMillimeters,
QgsUnitTypes.AreaUnknownUnit]
for u in units:
res, ok = QgsUnitTypes.stringToAreaUnit(QgsUnitTypes.toString(u))
assert ok
self.assertEqual(res, u)
# Test converting bad strings
res, ok = QgsUnitTypes.stringToAreaUnit('bad')
self.assertFalse(ok)
self.assertEqual(res, QgsUnitTypes.AreaUnknownUnit)
# Test that string is cleaned before conversion
res, ok = QgsUnitTypes.stringToAreaUnit(' {} '.format(QgsUnitTypes.toString(QgsUnitTypes.AreaSquareMiles).upper()))
assert ok
self.assertEqual(res, QgsUnitTypes.AreaSquareMiles)
示例4: testFromUnitToUnitFactor
def testFromUnitToUnitFactor(self):
"""Test calculation of conversion factor between units"""
expected = {QGis.Meters: {QGis.Meters: 1.0, QGis.Feet: 3.28083989501, QGis.Degrees: 0.00000898315, QGis.NauticalMiles: 0.000539957},
QGis.Feet: {QGis.Meters: 0.3048, QGis.Feet: 1.0, QGis.Degrees: 2.73806498599629E-06, QGis.NauticalMiles: 0.000164579},
QGis.Degrees: {QGis.Meters: 111319.49079327358, QGis.Feet: 365221.4264871, QGis.Degrees: 1.0, QGis.NauticalMiles: 60.1077164},
QGis.NauticalMiles: {QGis.Meters: 1852.0, QGis.Feet: 6076.1154856, QGis.Degrees: 0.0166367990650, QGis.NauticalMiles: 1.0},
QGis.UnknownUnit: {QGis.Meters: 1.0, QGis.Feet: 1.0, QGis.Degrees: 1.0, QGis.NauticalMiles: 1.0}
}
for from_unit in expected.keys():
for to_unit in expected[from_unit].keys():
expected_factor = expected[from_unit][to_unit]
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, to_unit)
self.assertAlmostEqual(res,
expected_factor,
msg='got {:.7f}, expected {:.7f} when converting from {} to {}'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit),
QgsUnitTypes.toString(to_unit)))
#test conversion to unknown units
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QGis.UnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
示例5: testAngleFromUnitToUnitFactor
def testAngleFromUnitToUnitFactor(self):
"""Test calculation of conversion factor between angular units"""
expected = {QgsUnitTypes.AngleDegrees: {QgsUnitTypes.AngleDegrees: 1.0, QgsUnitTypes.AngleRadians: 0.0174533, QgsUnitTypes.AngleGon: 1.1111111, QgsUnitTypes.AngleMinutesOfArc: 60, QgsUnitTypes.AngleSecondsOfArc: 3600, QgsUnitTypes.AngleTurn: 0.00277777777778},
QgsUnitTypes.AngleRadians: {QgsUnitTypes.AngleDegrees: 57.2957795, QgsUnitTypes.AngleRadians: 1.0, QgsUnitTypes.AngleGon: 63.6619772, QgsUnitTypes.AngleMinutesOfArc: 3437.7467708, QgsUnitTypes.AngleSecondsOfArc: 206264.8062471, QgsUnitTypes.AngleTurn: 0.159154943092},
QgsUnitTypes.AngleGon: {QgsUnitTypes.AngleDegrees: 0.9000000, QgsUnitTypes.AngleRadians: 0.015707968623450838802, QgsUnitTypes.AngleGon: 1.0, QgsUnitTypes.AngleMinutesOfArc: 54.0000000, QgsUnitTypes.AngleSecondsOfArc: 3240.0000000, QgsUnitTypes.AngleTurn: 0.0025},
QgsUnitTypes.AngleMinutesOfArc: {QgsUnitTypes.AngleDegrees: 0.016666672633390722247, QgsUnitTypes.AngleRadians: 0.00029088831280398030638, QgsUnitTypes.AngleGon: 0.018518525464057963154, QgsUnitTypes.AngleMinutesOfArc: 1.0, QgsUnitTypes.AngleSecondsOfArc: 60.0, QgsUnitTypes.AngleTurn: 4.62962962962963e-05},
QgsUnitTypes.AngleSecondsOfArc: {QgsUnitTypes.AngleDegrees: 0.00027777787722304257169, QgsUnitTypes.AngleRadians: 4.848138546730629518e-6, QgsUnitTypes.AngleGon: 0.0003086420910674814405, QgsUnitTypes.AngleMinutesOfArc: 0.016666672633325253783, QgsUnitTypes.AngleSecondsOfArc: 1.0, QgsUnitTypes.AngleTurn: 7.71604938271605e-07},
QgsUnitTypes.AngleTurn: {QgsUnitTypes.AngleDegrees: 360.0, QgsUnitTypes.AngleRadians: 6.2831853071795, QgsUnitTypes.AngleGon: 400.0, QgsUnitTypes.AngleMinutesOfArc: 21600, QgsUnitTypes.AngleSecondsOfArc: 1296000, QgsUnitTypes.AngleTurn: 1}
}
for from_unit in list(expected.keys()):
for to_unit in list(expected[from_unit].keys()):
expected_factor = expected[from_unit][to_unit]
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, to_unit)
self.assertAlmostEqual(res,
expected_factor,
msg='got {:.7f}, expected {:.7f} when converting from {} to {}'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit),
QgsUnitTypes.toString(to_unit)))
# test conversion to unknown units
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.AngleUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
示例6: testEncodeDecodeAngleUnits
def testEncodeDecodeAngleUnits(self):
"""Test encoding and decoding angle units"""
units = [
QgsUnitTypes.AngleDegrees,
QgsUnitTypes.Radians,
QgsUnitTypes.Gon,
QgsUnitTypes.MinutesOfArc,
QgsUnitTypes.SecondsOfArc,
QgsUnitTypes.Turn,
QgsUnitTypes.UnknownAngleUnit,
]
for u in units:
res, ok = QgsUnitTypes.decodeAngleUnit(QgsUnitTypes.encodeUnit(u))
assert ok, "could not decode unit {}".format(QgsUnitTypes.toString(u))
self.assertEqual(res, u)
# Test decoding bad units
res, ok = QgsUnitTypes.decodeAngleUnit("bad")
self.assertFalse(ok)
self.assertEqual(res, QgsUnitTypes.UnknownAngleUnit)
# Test that string is cleaned before decoding
res, ok = QgsUnitTypes.decodeAngleUnit(" MoA ")
assert ok
self.assertEqual(res, QgsUnitTypes.MinutesOfArc)
示例7: testEncodeDecodeLayoutUnits
def testEncodeDecodeLayoutUnits(self):
"""Test encoding and decoding layout units"""
units = [QgsUnitTypes.LayoutMillimeters,
QgsUnitTypes.LayoutCentimeters,
QgsUnitTypes.LayoutMeters,
QgsUnitTypes.LayoutInches,
QgsUnitTypes.LayoutFeet,
QgsUnitTypes.LayoutPoints,
QgsUnitTypes.LayoutPicas,
QgsUnitTypes.LayoutPixels]
for u in units:
res, ok = QgsUnitTypes.decodeLayoutUnit(QgsUnitTypes.encodeUnit(u))
assert ok
self.assertEqual(res, u)
# Test decoding bad units
res, ok = QgsUnitTypes.decodeLayoutUnit('bad')
self.assertFalse(ok)
# default units should be MM
self.assertEqual(res, QgsUnitTypes.LayoutMillimeters)
# Test that string is cleaned before decoding
res, ok = QgsUnitTypes.decodeLayoutUnit(' px ')
assert ok
self.assertEqual(res, QgsUnitTypes.LayoutPixels)
示例8: testEncodeDecodeDistanceUnits
def testEncodeDecodeDistanceUnits(self):
"""Test encoding and decoding distance units"""
units = [QgsUnitTypes.DistanceMeters,
QgsUnitTypes.DistanceKilometers,
QgsUnitTypes.DistanceFeet,
QgsUnitTypes.DistanceYards,
QgsUnitTypes.DistanceMiles,
QgsUnitTypes.DistanceDegrees,
QgsUnitTypes.DistanceCentimeters,
QgsUnitTypes.DistanceMillimeters,
QgsUnitTypes.DistanceUnknownUnit,
QgsUnitTypes.DistanceNauticalMiles]
for u in units:
res, ok = QgsUnitTypes.decodeDistanceUnit(QgsUnitTypes.encodeUnit(u))
assert ok
self.assertEqual(res, u)
# Test decoding bad units
res, ok = QgsUnitTypes.decodeDistanceUnit('bad')
self.assertFalse(ok)
self.assertEqual(res, QgsUnitTypes.DistanceUnknownUnit)
# Test that string is cleaned before decoding
res, ok = QgsUnitTypes.decodeDistanceUnit(' FeEt ')
assert ok
self.assertEqual(res, QgsUnitTypes.DistanceFeet)
示例9: test_ExpressionFieldEllipsoidLengthCalculation
def test_ExpressionFieldEllipsoidLengthCalculation(self):
#create a temporary layer
temp_layer = QgsVectorLayer("LineString?crs=epsg:3111&field=pk:int", "vl", "memory")
self.assertTrue(temp_layer.isValid())
f1 = QgsFeature(temp_layer.dataProvider().fields(), 1)
f1.setAttribute("pk", 1)
f1.setGeometry(QgsGeometry.fromPolyline([QgsPoint(2484588, 2425722), QgsPoint(2482767, 2398853)]))
temp_layer.dataProvider().addFeatures([f1])
# set project CRS and ellipsoid
srs = QgsCoordinateReferenceSystem(3111, QgsCoordinateReferenceSystem.EpsgCrsId)
QgsProject.instance().writeEntry("SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4())
QgsProject.instance().writeEntry("SpatialRefSys", "/ProjectCRSID", srs.srsid())
QgsProject.instance().writeEntry("SpatialRefSys", "/ProjectCrs", srs.authid())
QgsProject.instance().writeEntry("Measure", "/Ellipsoid", "WGS84")
QgsProject.instance().writeEntry("Measurement", "/DistanceUnits", QgsUnitTypes.encodeUnit(QGis.Meters))
idx = temp_layer.addExpressionField('$length', QgsField('length', QVariant.Double)) # NOQA
# check value
f = temp_layer.getFeatures().next()
expected = 26932.156
self.assertAlmostEqual(f['length'], expected, 3)
# change project length unit, check calculation respects unit
QgsProject.instance().writeEntry("Measurement", "/DistanceUnits", QgsUnitTypes.encodeUnit(QGis.Feet))
f = temp_layer.getFeatures().next()
expected = 88360.0918635
self.assertAlmostEqual(f['length'], expected, 3)
示例10: testLengthMeasureAndUnits
def testLengthMeasureAndUnits(self):
"""Test a variety of length measurements in different CRS and ellipsoid modes, to check that the
calculated lengths and units are always consistent
"""
da = QgsDistanceArea()
da.setSourceCrs(QgsCoordinateReferenceSystem.fromSrsId(3452), QgsProject.instance().transformContext())
da.setEllipsoid("NONE")
# We check both the measured length AND the units, in case the logic regarding
# ellipsoids and units changes in future
distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3))
units = da.lengthUnits()
print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units))))
assert ((abs(distance - 2.23606797) < 0.00000001 and units == QgsUnitTypes.DistanceDegrees) or
(abs(distance - 248.52) < 0.01 and units == QgsUnitTypes.DistanceMeters))
da.setEllipsoid("WGS84")
distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3))
units = da.lengthUnits()
print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units))))
# should always be in Meters
self.assertAlmostEqual(distance, 247555.57, delta=0.01)
self.assertEqual(units, QgsUnitTypes.DistanceMeters)
# test converting the resultant length
distance = da.convertLengthMeasurement(distance, QgsUnitTypes.DistanceNauticalMiles)
self.assertAlmostEqual(distance, 133.669, delta=0.01)
# now try with a source CRS which is in feet
da.setSourceCrs(QgsCoordinateReferenceSystem.fromSrsId(27469), QgsProject.instance().transformContext())
da.setEllipsoid("NONE")
# measurement should be in feet
distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3))
units = da.lengthUnits()
print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units))))
self.assertAlmostEqual(distance, 2.23606797, delta=0.000001)
self.assertEqual(units, QgsUnitTypes.DistanceFeet)
# test converting the resultant length
distance = da.convertLengthMeasurement(distance, QgsUnitTypes.DistanceMeters)
self.assertAlmostEqual(distance, 0.6815, delta=0.001)
da.setEllipsoid("WGS84")
# now should be in Meters again
distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3))
units = da.lengthUnits()
print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units))))
self.assertAlmostEqual(distance, 0.67953772, delta=0.000001)
self.assertEqual(units, QgsUnitTypes.DistanceMeters)
# test converting the resultant length
distance = da.convertLengthMeasurement(distance, QgsUnitTypes.DistanceFeet)
self.assertAlmostEqual(distance, 2.2294, delta=0.001)
示例11: testLengthMeasureAndUnits
def testLengthMeasureAndUnits(self):
"""Test a variety of length measurements in different CRS and ellipsoid modes, to check that the
calculated lengths and units are always consistent
"""
da = QgsDistanceArea()
da.setSourceCrs(3452)
da.setEllipsoidalMode(False)
da.setEllipsoid("NONE")
daCRS = QgsCoordinateReferenceSystem()
daCRS.createFromSrsId(da.sourceCrs())
# We check both the measured length AND the units, in case the logic regarding
# ellipsoids and units changes in future
distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3))
units = da.lengthUnits()
print "measured {} in {}".format(distance, QgsUnitTypes.toString(units))
assert ((abs(distance - 2.23606797) < 0.00000001 and units == QGis.Degrees) or
(abs(distance - 248.52) < 0.01 and units == QGis.Meters))
da.setEllipsoid("WGS84")
distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3))
units = da.lengthUnits()
print "measured {} in {}".format(distance, QgsUnitTypes.toString(units))
assert ((abs(distance - 2.23606797) < 0.00000001 and units == QGis.Degrees) or
(abs(distance - 248.52) < 0.01 and units == QGis.Meters))
da.setEllipsoidalMode(True)
distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3))
units = da.lengthUnits()
print "measured {} in {}".format(distance, QgsUnitTypes.toString(units))
# should always be in Meters
self.assertAlmostEqual(distance, 247555.57, delta=0.01)
self.assertEqual(units, QGis.Meters)
# now try with a source CRS which is in feet
da.setSourceCrs(27469)
da.setEllipsoidalMode(False)
# measurement should be in feet
distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3))
units = da.lengthUnits()
print "measured {} in {}".format(distance, QgsUnitTypes.toString(units))
self.assertAlmostEqual(distance, 2.23606797, delta=0.000001)
self.assertEqual(units, QGis.Feet)
da.setEllipsoidalMode(True)
# now should be in Meters again
distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3))
units = da.lengthUnits()
print "measured {} in {}".format(distance, QgsUnitTypes.toString(units))
self.assertAlmostEqual(distance, 0.67953772, delta=0.000001)
self.assertEqual(units, QGis.Meters)
示例12: setUnits
def setUnits(self, units):
self.label.setText(QgsUnitTypes.toString(units))
if QgsUnitTypes.unitType(units) != QgsUnitTypes.Standard:
self.units_combo.hide()
self.label.show()
else:
self.units_combo.setCurrentIndex(self.units_combo.findData(units))
self.units_combo.show()
self.label.hide()
self.warning_label.setVisible(units == QgsUnitTypes.DistanceDegrees)
self.base_units = units
示例13: getValue
def getValue(self):
val = super().getValue()
if isinstance(val, float) and self.units_combo.isVisible():
display_unit = self.units_combo.currentData()
return val * QgsUnitTypes.fromUnitToUnitFactor(display_unit, self.base_units)
return val
示例14: __init__
def __init__(self, param):
super().__init__(param)
self.label = QLabel('')
self.units_combo = QComboBox()
self.base_units = QgsUnitTypes.DistanceUnknownUnit
for u in (QgsUnitTypes.DistanceMeters,
QgsUnitTypes.DistanceKilometers,
QgsUnitTypes.DistanceFeet,
QgsUnitTypes.DistanceMiles,
QgsUnitTypes.DistanceYards):
self.units_combo.addItem(QgsUnitTypes.toString(u), u)
label_margin = self.fontMetrics().width('X')
self.layout().insertSpacing(1, label_margin / 2)
self.layout().insertWidget(2, self.label)
self.layout().insertWidget(3, self.units_combo)
self.layout().insertSpacing(4, label_margin / 2)
self.warning_label = QLabel()
icon = QgsApplication.getThemeIcon('mIconWarning.svg')
size = max(24, self.spnValue.height() * 0.5)
self.warning_label.setPixmap(icon.pixmap(icon.actualSize(QSize(size, size))))
self.warning_label.setToolTip(self.tr('Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results.'))
self.layout().insertWidget(4, self.warning_label)
self.layout().insertSpacing(5, label_margin)
self.setUnits(QgsUnitTypes.DistanceUnknownUnit)
示例15: createBackgroundSettings
def createBackgroundSettings(self):
s = QgsTextBackgroundSettings()
s.setEnabled(True)
s.setType(QgsTextBackgroundSettings.ShapeEllipse)
s.setSvgFile('svg.svg')
s.setSizeType(QgsTextBackgroundSettings.SizeFixed)
s.setSize(QSizeF(1, 2))
s.setSizeUnit(QgsUnitTypes.RenderPixels)
s.setSizeMapUnitScale(QgsMapUnitScale(1, 2))
s.setRotationType(QgsTextBackgroundSettings.RotationFixed)
s.setRotation(45)
s.setOffset(QPointF(3, 4))
s.setOffsetUnit(QgsUnitTypes.RenderMapUnits)
s.setOffsetMapUnitScale(QgsMapUnitScale(5, 6))
s.setRadii(QSizeF(11, 12))
s.setRadiiUnit(QgsUnitTypes.RenderPixels)
s.setRadiiMapUnitScale(QgsMapUnitScale(15, 16))
s.setFillColor(QColor(255, 0, 0))
s.setStrokeColor(QColor(0, 255, 0))
s.setOpacity(0.5)
s.setJoinStyle(Qt.RoundJoin)
s.setBlendMode(QPainter.CompositionMode_Difference)
s.setStrokeWidth(7)
s.setStrokeWidthUnit(QgsUnitTypes.RenderMapUnits)
s.setStrokeWidthMapUnitScale(QgsMapUnitScale(QgsMapUnitScale(25, 26)))
s.setPaintEffect(QgsBlurEffect.create({'blur_level': '6.0', 'blur_unit': QgsUnitTypes.encodeUnit(QgsUnitTypes.RenderMillimeters), 'enabled': '1'}))
return s