Skip to content

Commit

Permalink
Merge pull request #34 from FLO-2DKaren/comp-symbology
Browse files Browse the repository at this point in the history
Comp symbology
  • Loading branch information
FLO-2DKaren authored Jan 24, 2024
2 parents f8c0cbc + bcea91f commit 86087c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion rasterizor/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ repository=https://github.com/FLO-2DKaren/FLO-2D-Rasterizor

hasProcessingProvider=no
# Uncomment the following line and add your changelog:
changelog=0.3.1
changelog=
0.3.1
- Added a new symbology for comparison
- Allowed only rasters layers for comparison
0.3
- Added the difference between rasters
Expand Down
22 changes: 17 additions & 5 deletions rasterizor/rasterizor.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,29 @@ def setStyle(self, layer, style):
elif style == 5:

min = stats.minimumValue
max = stats.maximumValue

range_distance = max - min
zero_position = 0 - min
normalized_position = zero_position / range_distance

neg1 = (-0.1 - min) / range_distance
neg5 = (-0.05 - min) / range_distance
pos5 = (0.05 - min) / range_distance
pos1 = (0.1 - min) / range_distance

color_ramp = QgsGradientColorRamp(
QColor(QColor(colDic["blue"])),
QColor(QColor(colDic["red"])),
discrete=False, stops=[
QgsGradientStop(normalized_position, QColor(colDic["green"])),
])
QColor('#08306b'),
QColor('#FF0000'),
discrete=False,
stops=[
QgsGradientStop(neg1, QColor(158, 202, 225)),
QgsGradientStop(neg5, QColor(158, 202, 225, 0)),
QgsGradientStop(normalized_position, QColor(65, 171, 93, 0)),
QgsGradientStop(pos5, QColor(255, 127, 0, 0)),
QgsGradientStop(pos1, QColor(255, 127, 0)),
],
)

myPseudoRenderer = QgsSingleBandPseudoColorRenderer(
layer.dataProvider(), layer.type(), myRasterShader
Expand Down

0 comments on commit 86087c7

Please sign in to comment.