PROBLEM
Web Mapping Applications built with ArcGIS Server for the Microsoft .Net Framework or ArcGIS Server for the Java Platform only turn on the first 10 layers in the Table of Contents control for WMS services. This is analogous to the behavior in Desktop, where only the first 10 layers of a WMS service are turned on initially, by default.
The main reason that this limit is set for WMS services in Web Mapping Applications is to improve the performance and usability. More times than not, a WMS service has hundreds of layers available in its capabilities file, and turning them on all together usually causes a long delay or even a timeout during the Web Mapping Application's initialization.
Code:
protected void Page_Init(object sender, EventArgs e)
{
...
}
Code:
protected void Page_Init(object sender, EventArgs e)
{
IMapResource mapResource = MapResourceManager1.GetResource("MapResourceItem0");
if (mapResource != null)
{
ESRI.ArcGIS.ADF.Web.DataSources.OGCWMSService.MapResource wmsMapResource =
mapResource as ESRI.ArcGIS.ADF.Web.DataSources.OGCWMSService.MapResource;
if (wmsMapResource != null)
{
wmsMapResource.MaxInitialSelectedLayers = 25; //Example of turning on the first 25 layers by default
}
}
}
Article ID: 000009862
Get help from ArcGIS experts
Download the Esri Support App