[MapServer-users] PHP Mapscript: how to clone layers

Seth G sethg at geographika.co.uk
Sun Nov 26 12:20:53 PST 2023


Hi Jan,

I'm not a PHP MapScript user but you should be able to use:

$l2 = $l1->cloneLayer();

As per the note at the following link - "In the Java & PHP modules this method is named cloneLayer. "
https://mapserver.org/mapscript/mapscript-api/stub/mapscript.layerObj.html#mapscript.layerObj.clone

I'm guessing there is a clash with the a reserved keyword in PHP so the method needs a different name.

Seth

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika

On Sun, Nov 26, 2023, at 7:38 PM, Jan Hartmann via MapServer-users wrote:
> Hi,
>
> In previous versions of PHP MapScript a new layer was defined as:
>
> $l2 = new layerObj($oMap,$l1);
>
> $l1 is the base layer from which $l2 is copied.
>
> In MapScript SWIG the second parameter has disappeared. $l2 has to be 
> cloned from $l1, and then inserted into the map. With PHP-MapScript this 
> should be:
>
> $l2 = $l1->clone();
> $oMap->insertLayer($l2);
>
> But there is no PHP-MapScript function layerObj::clone. What do I miss?
>
> Jan
>
>
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the MapServer-users mailing list