FRAMES | NO FRAMES
RemoveLayersFromMap Method

Removes layers from the default map.

Availability: Business Analyst Server 9.3.1 SP1.

bool RemoveLayersFromMap ( 
    RemoveLayersFromMapParameters  Parameters
);

Parameter Description
Parameters Configuration options for the utility. Type RemoveLayersFromMapParameters.

Returns

Variable of type Boolean whose true value means that at least one layer was removed.

Examples

The example below adds a repository layer to the map and then removes it.

NOTE: The signature of the BAServerHelper.RemoveLayersFromMap method is simplified against this method—an array of strings is passed in parameters instead of RemoveLayersFromMapParameters type.

C#
// Instantiate the BAServerHelper class to access analysis methods
BAServerHelper baServerHelper = new BAServerHelper();
baServerHelper.ActiveDatasetID = "USA_ESRI"; // Optional parameter
baServerHelper.IsFullErrorMessage = true;    // Default is false
 
// ========= STEP 1: Create a store layer in the repository
 
// Create a PointRecord array of 1 store location.
PointRecord[] storePoints = new PointRecord[1];
 
storePoints[0] = new PointRecord();
storePoints[0].Name = "storePoint";
storePoints[0].Description = "Ring Center";
storePoints[0].StoreID = "1";
storePoints[0].Latitude = 34.057596;
storePoints[0].Longitude = -117.195683;
 
CustomerStoreSetupByCoordinatesParameters storeSetupParameters = new CustomerStoreSetupByCoordinatesParameters();
 
// Set specific analysis parameters
storeSetupParameters.GeocodeCustomers = false;
storeSetupParameters.NameField = "Name";
storeSetupParameters.Points = storePoints;
storeSetupParameters.StoreIDField = "STORE_ID";
 
// Set other parameters
RenderingParameters imageOptions = null;
TaskOutputType[] outputOptions = new TaskOutputType[0]; // Empty output!
 
// In general, a non-null esriFolderItem is specified to save a newly-created
// item to the server-side repository or to reference an existing item in it.
esriFolderItem storeLayerItem = new esriFolderItem();
storeLayerItem.folderType = esriFolderType.esriFolderStoreLayers;
storeLayerItem.itemName = "storeLayer_RemoveLayersFromMap";
storeLayerItem.workspaceName = "Default Workspace";
storeLayerItem.projectName = "Default Project";
 
baServerHelper.CustomerStoreSetupByCoordinates(storeSetupParameters, imageOptions, outputOptions, storeLayerItem);
 
// ========= STEP 2: Add the store layer to the default map and then remove it
 
esriLayerItem myLayer = new esriLayerItem();
myLayer.LayerItem = storeLayerItem;
myLayer.LayerTransparency = 50;
myLayer.LayerName = "MyStoreLayer";
 
baServerHelper.AddLayersToMap(new esriLayerItem[] { myLayer });
bool removed = baServerHelper.RemoveLayersFromMap(new string[] { "MyStoreLayer" });

See Also