<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Yes, that's it. Thanks, Seth!<br>
    <br>
    It was an insidious migration problem. The old way of cloning a
    layer (<span style="white-space: pre-wrap">$l2 = new layerObj($oMap,$l1);) still works, but ignores the second parameter. So you get a default new layer, with STATUS OFF. I filled every member but that. No wonder the layers didn't turn on. Could this function be made to fail when called with two parameters?

</span>
    <div class="moz-cite-prefix">On 26/11/2023 21:20, Seth G wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9bb1afa9-e906-41ff-bd52-7435d8a96d48@app.fastmail.com">
      <pre class="moz-quote-pre" wrap="">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. "
<a class="moz-txt-link-freetext" href="https://mapserver.org/mapscript/mapscript-api/stub/mapscript.layerObj.html#mapscript.layerObj.clone">https://mapserver.org/mapscript/mapscript-api/stub/mapscript.layerObj.html#mapscript.layerObj.clone</a>

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

Seth

--
web:<a class="moz-txt-link-freetext" href="https://geographika.net">https://geographika.net</a> & <a class="moz-txt-link-freetext" href="https://mapserverstudio.net">https://mapserverstudio.net</a>
twitter: @geographika

On Sun, Nov 26, 2023, at 7:38 PM, Jan Hartmann via MapServer-users wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">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
<a class="moz-txt-link-abbreviated" href="mailto:MapServer-users@lists.osgeo.org">MapServer-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a>
</pre>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>