<div>Hi Tamas,</div>
<div>&nbsp;</div>
<div>I am using the binary downloaded here:&nbsp; (MS4W 2.1)</div>
<div><a href="http://www.maptools.org/ms4w/index.phtml?page=downloads.html">http://www.maptools.org/ms4w/index.phtml?page=downloads.html</a></div>
<div><br>I noticed that there is a new beta source version, but I do not compile it yet.</div>
<div>&nbsp;</div>
<div>I do not tried with the other hard coded layers, but I think it may have the same problem, here is the code caused the strange problems:</div>
<div>&nbsp;</div>
<div>1. this works well with index:&nbsp; -- insertLayer</div><font size="2">
<p>objMapping.insertLayer(objMapTemp, shapeRegionLayer, objMapping.getLayerIndex(</p></font><font color="#800000" size="2">&quot;France_Departements&quot;</font><font size="2">, objMapTemp) + 1)</font>
<p><font size="2">-- the last parameter is the index value I used to insert the inline layer &quot;shapeRegionLayer&quot;, the layer <font size="2"><font color="#800000">&quot;France_Departements&quot;</font><font color="#000000">
 is a hard coded layer in mapfile. </font></font></font></p>
<p><font size="2">2. but I am not so&nbsp;lucky enough with this one: -- insertLayer</font></p><font size="2"><font size="2">
<p>objMapping.insertLayer(objMapTemp, shapeCommunesLayer, 11)</p>
<p>-- here only the index value -1 works, any other value will cause exceptions like: msFreeHashItems(): hash table error.</p>
<p>3. this does not work:</p><font color="#0000ff" size="2">
<p>Dim</p></font><font size="2"> tempLayer </font><font color="#0000ff" size="2">As</font><font size="2"> layerObj = objParentMap.getLayerByName(strLayerName)
<p></p></font><font color="#0000ff" size="2">Dim</font><font size="2"> intIndex </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = tempLayer.index
()
<p>objParentMap.removeLayer(intIndex)</p></font></font></font>
<div>I will test the removeLayer method again with a hard coded layer.</div>
<div>&nbsp;</div>
<div>Do you have any other ideas to remove a layer from the map object?</div>
<div>&nbsp;</div>
<div>Thanks</div>
<div>&nbsp;</div>
<div>Zhonghai</div>
<div><br>&nbsp;</div>
<div><span class="gmail_quote">On 8/28/06, <b class="gmail_sendername">Tamas Szekeres</b> &lt;<a href="mailto:szekerest@gmail.com">szekerest@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Zhonghai,<br><br>There was problem with insertLayer according to<br><a href="http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1838">
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1838</a><br><br>The problem was recently fixed (4.10.0-beta1 should contain the fix).<br><br>Is the removeLayer problem also exist for the other layers? (not for<br>the dynamically added layers)
<br><br>Which mapserver version are you using?<br>Could you include a code sample according to the problem?<br><br>Tamas<br><br><br>2006/8/28, Zhonghai Wang &lt;<a href="mailto:zhonghaiw@gmail.com">zhonghaiw@gmail.com</a>
&gt;:<br>&gt;<br>&gt; Hi guys,<br>&gt;<br>&gt; I am trying to remove an inline feature using the map.removeLayer(index),<br>&gt; but it seems that this method does not work. The inline feature layer is<br>&gt; created on the fly, not in the mapfile hard coded. Does anyone ever used
<br>&gt; this function successfully? There may also be some problems with the<br>&gt; map.insertLayer(layerObj, index), only map.insertLayer(layerObj,-1) works<br>&gt; for me, I can not specify the index.<br>&gt;<br>&gt;<br>
&gt; thanks for any hints to solve my problem.<br>&gt;<br>&gt;<br>&gt; Zhonghai<br>&gt;<br></blockquote></div><br>