php mapscript set opacity

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

php mapscript set opacity

Sven Schroeter
Hi,

I'm trying to transfer old code from Mapserver  6 to Mapserver 7 and fail to
set the transparency via PHP Mapscript.


my code:
$this_layer->set('opacity', 80);   Works with MS 6, not in MS 7 (the layer
is not displayed here)

$this_layer->set('opacity', 100); Works with MS 6 and MS 7

I have read the Migration guide, but I don't know what to do with it in this
case.

Thanks
Sven

_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: php mapscript set opacity

Sven Schroeter
Hi Carlos,

thank you very much, that was the trick and it works great.
Here is my new code (tested with MS 7.07):

if(ms_GetVersionInt() >= 70000){
        $this_layer->updateFromString('LAYER COMPOSITE OPACITY '.$my_layeropacity.' END END');
}else{
        $this_layer->set('opacity', $my_layeropacity);
}

Greetings
Sven



Von: Carlos Ruiz [mailto:[hidden email]]
Gesendet: Samstag, 9. Dezember 2017 00:58
An: Sven Schroeter
Betreff: Re: [mapserver-users] php mapscript set opacity

Hi Sven,

I guess this happens because of the new COMPOSITE block:

COMPOSITE
    OPACITY 100
END

I remember that I had the same problem, and I had to use $layer->updateFromString() to set the opacity. As far as I can recall, this is a known issue, no methods to change opacity nor composite are available for PHP mapscript.

On Friday, December 8, 2017, 2:20:06 AM CST, Sven Schroeter <[hidden email]> wrote:


Hi,

I'm trying to transfer old code from Mapserver  6 to Mapserver 7 and fail to
set the transparency via PHP Mapscript.


my code:
$this_layer->set('opacity', 80);  Works with MS 6, not in MS 7 (the layer
is not displayed here)

$this_layer->set('opacity', 100); Works with MS 6 and MS 7

I have read the Migration guide, but I don't know what to do with it in this
case.

Thanks
Sven

_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users