FRAMES | NO FRAMES |
Renders repository items and returns a map image.
Availability: Business Analyst Server.
MapImage RenderAnalyses ( esriLayerItem[] AnalysisItems, ImageDescription ImageDescription, MapDescription MapDescription );
Parameter | Description |
---|---|
AnalysisItems | Layer items in the repository that will be rendered as an image. Type esriLayerItem[]. |
ImageDescription | (Optional
parameter — can be null). Image configuration options for rendering output. Type ImageDescription. |
MapDescription | (Optional
parameter — can be null). Map configuration options for rendering output. Type MapDescription. |
Variable of type MapImage
If the MapDescription parameter is null, the analyses are rendered on the default map.
If the ImageDescription parameter is null, the default values for rendered image will be used.
The example below generates a downloadable image file from an existing feature layer stored in the Business Analyst Server Repository.
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 // You can specify below a domain of your local Business Analyst Server. //baServerHelper.BAServerDomain = "esri.com"; // If a domain name is specified, a local server name in output URLs is replaced with the // fully-addressable server name so people and machines outside the domain of your local // Business Analyst Server instance can access these URLs. RenderingParameters imageOptions; TaskOutputType[] outputOptions; esriFolderItem outputReport; // ========= 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 imageOptions = null; 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_RenderAnalyses"; storeLayerItem.workspaceName = "Default Workspace"; storeLayerItem.projectName = "Default Project"; baServerHelper.CustomerStoreSetupByCoordinates(storeSetupParameters, imageOptions, outputOptions, storeLayerItem); PointLayer storeLayer = new PointLayer(); storeLayer.Item = storeLayerItem; // Use the repository item in this sample // ========= STEP 2: Create simple rings around the store and save the analysis in the repository SimpleRingsParameters simpleRingsParameters = new SimpleRingsParameters(); // Set specific analysis parameters simpleRingsParameters.DistanceUnits = esriUnits.esriMiles; simpleRingsParameters.Radii = new double[] { 1, 3, 5 }; simpleRingsParameters.StoreIDField = "STORE_ID"; simpleRingsParameters.Stores = storeLayer; // Set other parameters imageOptions = null; outputOptions = new TaskOutputType[0]; // Empty output! outputReport = null; // 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 taLayerItem = new esriFolderItem(); taLayerItem.folderType = esriFolderType.esriFolderTradeAreas; taLayerItem.itemName = "simpleRings_RenderAnalyses"; taLayerItem.projectName = "Default Project"; taLayerItem.workspaceName = "Default Workspace"; baServerHelper.SimpleRings(simpleRingsParameters, imageOptions, outputOptions, taLayerItem, outputReport); // ========= STEP 3: Render the store layer and the analysis result esriLayerItem[] layers = new esriLayerItem[2]; layers[0] = new esriLayerItem(); layers[0].LayerItem = taLayerItem; layers[0].LayerTransparency = 50; layers[1] = new esriLayerItem(); layers[1].LayerItem = storeLayerItem; layers[1].LayerTransparency = 50; ImageDisplay imageDisplay = new ImageDisplay(); imageDisplay.ImageDPI = 96; imageDisplay.ImageHeight = 480; imageDisplay.ImageWidth = 600; ImageType imageType = new ImageType(); imageType.ImageFormat = esriImageFormat.esriImageJPG; imageType.ImageReturnType = esriImageReturnType.esriImageReturnURL; ImageDescription imageDescription = new ImageDescription(); imageDescription.ImageDisplay = imageDisplay; imageDescription.ImageType = imageType; MapDescription mapDescription = new MapDescription(); mapDescription = baServerHelper.GetDefaultMapDescription(); MapImage mapImage = baServerHelper.RenderAnalyses(layers, imageDescription, mapDescription); string imageURL = mapImage.ImageURL; |