[mapserver-users] Remove Layer based on layer Name C#

Venkat Rao Tammineni vtammineni at roulacglobal.com
Wed Dec 17 02:41:24 EST 2008


Dear Sir

 

     Can you please tell me how remove specific layer or at least clear the
layer form map. I can able to clear the layer based on index.but if I click
clear layer button again it is clearing whatever the 0 position next layer.

 

     For example  my map contains  the layers called  Continents and
countries and states  that is like 

0 ,1, 2 position. If I want to remove continents (0) that is in 0 position ,
if I use MapFunction.Map.removeLayer(0); , it is working fine. If I Click
the same button again countries will be the second position then the country
layer is removing .but I want to remove single layer.

 

  protected void btnClearPointLayer_Click(object sender, EventArgs e)

        {

            if(Page.IsPostBack)

            {

                MapFunction.Map.removeLayer(0);

            }

         

        }



Is it Possible every time  same layer removable(dynamically the same layer
will be adding).

 

I am waiting for your great response.

 

Advanced Thanks

 

Regards

 

Venkat.

From: Tamas Szekeres [mailto:szekerest at gmail.com] 
Sent: Tuesday, December 16, 2008 10:03 PM
To: Venkat Rao Tammineni
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Remove Layer based on layer Name C#

 

Hi,

How about doing this?

layer = MapFunction.Map.getLayerByName("PointLayer");

MapFunction.Map.removeLayer(layer.index);


Best regards,

Tamas




2008/12/16 Venkat Rao Tammineni <vtammineni at roulacglobal.com>

     Dear All,

 

                I want remove layer based on Layer Name.Now I Can able to
remove layer based on index.Is it possible to do.

 

layer = MapFunction.Map.getLayerByName("PointLayer");

 

            MapFunction.Map.removeLayer(0);

 

Thanks

Venkat.


_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081217/0b378fec/attachment.html


More information about the mapserver-users mailing list