map.removeLayer(index) -- C#

Zhonghai Wang zhonghaiw at GMAIL.COM
Mon Aug 28 13:27:41 EDT 2006


Hi Tamas,

I am using the binary downloaded here:  (MS4W 2.1)
http://www.maptools.org/ms4w/index.phtml?page=downloads.html

I noticed that there is a new beta source version, but I do not compile it
yet.

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:

1. this works well with index:  -- insertLayer

objMapping.insertLayer(objMapTemp, shapeRegionLayer,
objMapping.getLayerIndex("France_Departements", objMapTemp) + 1)

-- the last parameter is the index value I used to insert the inline layer
"shapeRegionLayer", the layer "France_Departements" is a hard coded layer in
mapfile.

2. but I am not so lucky enough with this one: -- insertLayer

objMapping.insertLayer(objMapTemp, shapeCommunesLayer, 11)

-- here only the index value -1 works, any other value will cause exceptions
like: msFreeHashItems(): hash table error.

3. this does not work:

Dim tempLayer As layerObj = objParentMap.getLayerByName(strLayerName)

Dim intIndex As Integer = tempLayer.index()

objParentMap.removeLayer(intIndex)
I will test the removeLayer method again with a hard coded layer.

Do you have any other ideas to remove a layer from the map object?

Thanks

Zhonghai


On 8/28/06, Tamas Szekeres <szekerest at gmail.com> wrote:
>
> Zhonghai,
>
> There was problem with insertLayer according to
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1838
>
> The problem was recently fixed (4.10.0-beta1 should contain the fix).
>
> Is the removeLayer problem also exist for the other layers? (not for
> the dynamically added layers)
>
> Which mapserver version are you using?
> Could you include a code sample according to the problem?
>
> Tamas
>
>
> 2006/8/28, Zhonghai Wang <zhonghaiw at gmail.com>:
> >
> > Hi guys,
> >
> > I am trying to remove an inline feature using the map.removeLayer
> (index),
> > but it seems that this method does not work. The inline feature layer is
> > created on the fly, not in the mapfile hard coded. Does anyone ever used
> > this function successfully? There may also be some problems with the
> > map.insertLayer(layerObj, index), only map.insertLayer(layerObj,-1)
> works
> > for me, I can not specify the index.
> >
> >
> > thanks for any hints to solve my problem.
> >
> >
> > Zhonghai
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060828/c319a408/attachment.html


More information about the mapserver-users mailing list