transparency with php mapscript

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

transparency with php mapscript

Sven Schroeter
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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: transparency with php mapscript

jmckenna
Administrator
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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: transparency with php mapscript

jmckenna
Administrator
I forgot to mention that that test script uses an important trick to
test: it saves the mapfile to a temporary file, where you can confirm
that a COMPOSITE object is indeed created (here is that script again
https://ms4w.com/trac/wiki/SWIGMapScriptOpacity )

-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 8:47 AM, Jeff McKenna wrote:

> 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
>
>
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users