HI Alistair,

I ran into a similar problem recently which may be related - see 
https://github.com/MapServer/MapServer/pull/7200
This was related to bindings though, so it may not resolve it. 
Are you able to test your use case with this patch?

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika@mastodon.social

On Thu, Dec 19, 2024, at 3:35 PM, Alistair Everett via MapServer-users wrote:
> 
> Hi all,
> 
> Using the python API I'm trying to set a colorrange which includes a gradient 
> to alpha (so that the bottom end of the colorscale is transparent). I've seen 
> examples which suggest this should work from the mapfile eg. 
> https://github.com/MapServer/MapServer/blob/main/msautotest/gdal/heat.map.
> 
> I'm trying to do it using the python API, I've tried setting the max and the 
> min like this:
> 
>     color_style.maxcolor = ms.colorObj("#00ffff00")
>     color_style.mincolor = ms.colorObj("#000000ff")
> 
> but the alpha value disappears when I check the color style, and also 
> defining manually like `COLORRANGE  "#00ffff00"  "#000000ff"` and then using 
> updateFromString().
> 
> When I check the string everything looks correct:
> 
> STYLE
>   COLORRANGE  "#00ffff00"  "#000000ff"
>   DATARANGE 0.100000 1.000000
> END # STYLE
> but after I've run update from string, it seems to reinterpret as RGB without 
> the alpha value:
> 
> CLASS
>   NAME "Yellow-brown shade gradient"
>   GROUP "Yellow-brown_shade_gradient"
>   STYLE
>     COLORRANGE 0 255 255  0 0 0
>     DATARANGE 0.100000 1.000000
>   END # STYLE
> END # CLASS
> 
> And then I don't get any transparency in the resulting layer. Am I doing 
> something wrong, or is there any way around this using the API?
> 
> Thanks,
> Alistair
> 
> _______________________________________________
> MapServer-users mailing list
> MapServer-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to