<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>Hi paul,<br>
<br>
Thanks for the code! I had had almost everything, except the $oMap-&gt;save($_SESSION['maps'][$mapName]); part, which turned out to be sort of critical ;). It works now.<br>
<br>
But your explanation about&nbsp; changing the mapfile structure led me to wondering if my idea is the right way to go.<br>
<br>
I'm trying to create a simple raster querying tool that allows user to show only those portions of a geological depth map that are above or below a certain (user-defined) level, while also retaining the original raster in the TOC. I was planning to do this by (in Mapscript) creating a copy of the relevant raster, and by adding a classification (non-relevant pixels -&gt; transparent) showing the result of the query. <br>
<br>
But I'd like to be sure that I'm changing only the map for the current user/session, and not for other users who are using the mapserver at that time. Will this do the trick?<br>
<br>
Cheers,<br>
Tom<br>
 <br>
<br>
<span style="font-weight: bold;">On Thu 11/03/10 16:52 , Paul Spencer pspencer@dmsolutions.ca sent:<br>
</span><blockquote style="border-left: 2px solid rgb(245, 245, 245); margin-left: 5px; margin-right: 0px; padding-left: 5px; padding-right: 0px;">Hi Tom,<br>

<br>

The fusion framework makes a temporary copy of the original map file for use in the current user's session so that it can be manipulated without affecting other users.  If you want to change the map file structure in some way, you need to make an ajax call to a server side script and then reload the map on the client side (which you are already doing obviously.  The ajax request must include the map name, typically the javascript would look something like this:<br>

<br>

myFunction: function() {<br>

    var map = Fusion.getMapByIndice(0); // a reference to a mapserver map<br>

    var url = 'path/to/my/php/script.php'; // correct URL to your php script<br>

    var params = {<br>

      mapname: map._sMapname,<br>

      session: map.getSessionID(),<br>

      myparam: 'some value' // add all the parameters you want to send as key: value pairs<br>

    };<br>

    var options = {<br>

      onSuccess: OpenLayers.Function.bind(map.reloadMap, map),<br>

      parameters: params<br>

    };<br>

    Fusion.ajaxRequest(url, options);<br>

}<br>

<br>

you need to be doing something like this on the server side:<br>

<br>


include ("/path/to/fusion/layers/MapServer/php/Common.php");<br>

<br>

if (isset($_SESSION['maps']) &amp;&amp; isset($_SESSION['maps'][$mapName])) {<br>

    $oMap = ms_newMapObj($_SESSION['maps'][$mapName]);<br>

    $myparam = $_REQUEST['myparam'];<br>

    // your code that manipulates $oMap<br>

    $oMap-&gt;save($_SESSION['maps'][$mapName]);<br>

}<br>

?&gt;<br>

<br>

That's pretty much the simplest way to implement what you need to do I think.  Does that make sense?<br>

<br>

Cheers<br>

<br>

Paul<br>

<br>

On 2010-03-11, at 10:18 AM, Tom van der Putte wrote:<br>

<br>

<span style="color: rgb(102, 102, 102);">&gt; Hi Paul,</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; I was doing 3), but  that's about it. Could you give me some pointers on how to do do 1) and 2)?</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Cheers,</span><br>

<span style="color: rgb(102, 102, 102);">&gt; Tom</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; On Thu 11/03/10 16:09 , Paul Spencer <a href="javascript:top.opencompose('pspencer@dmsolutions.ca','','','')">pspencer@dmsolutions.ca</a> sent:</span><br>

<span style="color: rgb(102, 102, 102);">&gt; are you:</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; 1) modifying the session copy of the map file</span><br>

<span style="color: rgb(102, 102, 102);">&gt; 2) saving the session copy of the map file after modification</span><br>

<span style="color: rgb(102, 102, 102);">&gt; 3) reloading the map on the client side</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Cheers</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Paul</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; On 2010-03-11, at 9:26 AM, Tom van der Putte wrote:</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; Hi All,</span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; I have a map with several layergroups, and want to make a copy of a user-picked layer in a group by doing an ajax call to a PHP Mapscript. This script executes $oMap-&gt;insertLayer($oLayer). This works perfectly in the PHP Mapscript environment ($oMap-&gt;getAllLayerNames() shows all layers including the copy). But when the ajax call returns, the layer has not been added to the map. Any ideas why this is? </span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; Cheers,</span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; Tom</span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; _______________________________________________</span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; fusion-users mailing list</span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; <a href="javascript:top.opencompose('fusion-users@lists.osgeo.org','','','')">fusion-users@lists.osgeo.org</a></span><br>

<span style="color: rgb(102, 102, 102);">&gt; &gt; <a target="_blank" href="parse.php?redirect=http%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Ffusion-users"><span style="color: red;">http://lists.osgeo.org/mailman/listinfo/fusion-users</span></a></span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; __________________________________________</span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Paul Spencer</span><br>

<span style="color: rgb(102, 102, 102);">&gt; Chief Technology Officer</span><br>

<span style="color: rgb(102, 102, 102);">&gt; DM Solutions Group Inc</span><br>

<span style="color: rgb(102, 102, 102);">&gt; <a target="_blank" href="parse.php?redirect=http%3A%2F%2Fresearch.dmsolutions.ca%2F"><span style="color: red;">http://research.dmsolutions.ca/</span></a></span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<span style="color: rgb(102, 102, 102);">&gt; </span><br>

<br>

<br>

__________________________________________<br>

<br>

   Paul Spencer<br>

   Chief Technology Officer<br>

   DM Solutions Group Inc<br>

   <a target="_blank" href="parse.php?redirect=http%3A%2F%2Fresearch.dmsolutions.ca%2F"><span style="color: red;">http://research.dmsolutions.ca/</span></a><br>

<br>

<br>

</blockquote></HTML>