<div>Hi Tamas,</div>
<div> </div>
<div>I am using the binary downloaded here: (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> </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> </div>
<div>1. this works well with index: -- insertLayer</div><font size="2">
<p>objMapping.insertLayer(objMapTemp, shapeRegionLayer, objMapping.getLayerIndex(</p></font><font color="#800000" size="2">"France_Departements"</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 "shapeRegionLayer", the layer <font size="2"><font color="#800000">"France_Departements"</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 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> </div>
<div>Do you have any other ideas to remove a layer from the map object?</div>
<div> </div>
<div>Thanks</div>
<div> </div>
<div>Zhonghai</div>
<div><br> </div>
<div><span class="gmail_quote">On 8/28/06, <b class="gmail_sendername">Tamas Szekeres</b> <<a href="mailto:szekerest@gmail.com">szekerest@gmail.com</a>> 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 <<a href="mailto:zhonghaiw@gmail.com">zhonghaiw@gmail.com</a>
>:<br>><br>> Hi guys,<br>><br>> I am trying to remove an inline feature using the map.removeLayer(index),<br>> but it seems that this method does not work. The inline feature layer is<br>> created on the fly, not in the mapfile hard coded. Does anyone ever used
<br>> this function successfully? There may also be some problems with the<br>> map.insertLayer(layerObj, index), only map.insertLayer(layerObj,-1) works<br>> for me, I can not specify the index.<br>><br>><br>
> thanks for any hints to solve my problem.<br>><br>><br>> Zhonghai<br>><br></blockquote></div><br>