Re: transparency with php mapscript

Jeff McKenna <[email protected]> Thu, 16 May 2019 08:47:55 -0300
Newsgroups gmane.comp.gis.mapserver.user
Message-ID <[email protected]>
Hi Sven,

As you know, all methods and functions are now listed in the SWIG API 
reference document when using MS4W 4.0, and in the layerObj methods 
section you can see a setOpacity() function 
(https://mapserver.org/mapscript/mapscript.html#layerobj-methods).

Another trick is to open the local included file 
"C:/ms4w/apps/phpmapscriptng-swig/include/mapscript.php" in your text 
editor and search for "opacity" or "setOpacity" there, just to confirm 
with your local installation of MS4W.

Recently another MS4W user asked about opacity, so I had created a test 
script showing setOpacity() in action with SWIG MapScript: 
https://ms4w.com/trac/wiki/SWIGMapScriptNewLayer

However, I admit that that example script is long and opacity is kind of 
hidden in the code, so I have created another example for you at: 
https://ms4w.com/trac/wiki/SWIGMapScriptOpacity which takes an existing 
layer and adds a COMPOSITE object with the command:

   // set opacity (actually creates a new COMPOSITE object)
   $oPolyLayer->setOpacity(40);

I hope that makes it more clear.

-jeff


-- 

Thank you for using MS4W.
"MS4W: open doors as well as windows"


-- 
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/



On 2019-05-16 5:29 AM, Sven Schroeter wrote:
> Hello,
> 
> I test current php mapscript versions under Windows and try to give a 
> layer transparency.
> 
> With mapserver versions < 7 this was possible:
> 
> $layer_poly->opacity = 68;
> 
> With the version MS4W 3.3.1 with Mapserver > 7 and PHP Mapscript it 
> works like this:
> 
> $layer_poly->updateFromString('LAYER COMPOSITE OPACITY 68 END END');
> 
> In the new version MS4W 4.0.0 with the SWIG API I tried the following 
> variants:
> 
> $layer_poly->opacity = 68;
> $layer_poly->setOpacity(68);
> $layer_poly->updateFromString('LAYER COMPOSITE OPACITY 68 END END');
> 
> In all variants no error message, but also no transparency.
> 
> Any ideas?
> 
> Thanks Sven
> 
> 
> 
_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users