Skip to content

Commit

Permalink
Merge pull request pblottiere#43 from pblottiere/singlebandpseudocolo…
Browse files Browse the repository at this point in the history
…r_stops

Add gradient stops for singlebandpseudocolor renderer
  • Loading branch information
pblottiere authored Jun 26, 2024
2 parents 6ab1146 + b6699a7 commit 212f0c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions qsa-api/qsa_api/api/symbology.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def symbology_raster_singlebandpseudocolor():
"name": f"Spectral ({ramps})",
"color1": "0,0,0,255",
"color2": "255,255,255,255",
"stops": "0.2;2,2,11,255:0.8;200,200,110,255",
"interpolation": "Linear (Linear, Discrete, Exact)",
}
props["contrast_enhancement"] = {
Expand Down
4 changes: 4 additions & 0 deletions qsa-api/qsa_api/raster/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,12 @@ def _singlebandpseudocolor_properties(renderer) -> dict:
color_2 = (
shader_fct.sourceColorRamp().properties()["color2"].split("rgb")[0]
)
stops = (
shader_fct.sourceColorRamp().properties()["stops"]
)
props["ramp"]["color1"] = color_1
props["ramp"]["color2"] = color_2
props["ramp"]["stops"] = stops

ramp_type = shader_fct.colorRampType()
if ramp_type == QgsColorRampShader.Discrete:
Expand Down

0 comments on commit 212f0c1

Please sign in to comment.