Thanks for reading my problem.
I have multiple shape files (With Different Village Names). I have loaded that shape files on different layers.
I want that Layer name where user click on map.
How to identify the Layer name on user click event on Map?
How to find layer name on Mapclick event?
Hi Djay,
In general, we can find the layer based on its key value which is given when adding the layer to the map. Some codes like the below:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
…
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(MapPath("~/SampleData/world/cntry02.shp"));
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay staticOverlay = new LayerOverlay("StaticOverlay");
staticOverlay.IsBaseOverlay = false;
staticOverlay.Layers.Add("WorldLayer", worldLayer);
Map1.CustomOverlays.Add(staticOverlay);
}
}
protected void Map1_Click(object sender, MapClickedEventArgs e)
{
LayerOverlay staticOverlay = (LayerOverlay)Map1.CustomOverlays["StaticOverlay"];
FeatureLayer worldLayer = (FeatureLayer)staticOverlay.Layers["WorldLayer"];
The above codes is from our HowDoI sample=>QueryingFeatureLayers=>GetDataWhenUserClicks. We can find the HowDoI sample under our installation folder or review it by online. websamples.thinkgeo.com
Hope it helps.
Troy