FRAMES | NO FRAMES |
Creates a report which includes map image(s) accompanied with custom user data and graphics.
Availability: Business Analyst Server 10.0 SP3.
TaskResultOutput MapReport ( MapReportParameters Parameters, esriReportFormat ReportFormat, TaskOutputType[] OutputTypes, esriFolderItem OutputReportItem );
Parameter | Description |
---|---|
Parameters | Configuration options for analysis. Type MapReportParameters. |
ReportFormat | This parameter should be null. This parameter is deprecated. |
OutputTypes | Array of task output options. Options for this method include creating a report (GetReport). Type TaskOutputType[]. |
OutputReportItem | (Optional
parameter — can be null). Configuration options for storing the output report in the repository. This will enable viewing and working with the output result in subsequent tasks. Type esriFolderItem. |
Variable of type TaskResultOutput
The MapReport method allows users of Business Analyst Server to create reports that allow for map images to be returned in the resulting report. The map image is based on a map area and an array of map description objects. Every map description includes a map service URL and a collection of custom graphic elements drawn over the map. Images produced with map descriptions will be combined into the map image using the Opacity value set for every map description object.
This method allows creating a report using one of available map report templates. Some map report templates allow more than one map to be shown in the report. In this case, you could specify additional maps after the main map within the Maps array in report parameters. The main map is required. Additional maps are optional.
The map report template is selected with the TemplateName parameter of the report options. There are five map report templates that are available now:
Template Name | Description |
---|---|
Map Report | This report template supports a main map and a map legend. |
Map Report Landscape | This report template supports a main map and a map legend. It is formatted to use a landscape layout. |
Map Report Extended | This report template supports a portrait report with a main map, one additional inset map, and a map legend. The additional map is shown in smaller size. If the additional map is absent, the main map is shown in place of the additional map. |
Site Map Report | This report template supports a portrait report with a main map and two inset maps. The map legend isn't supported with this template. The additional inset maps are shown in smaller size. If the first additional map is absent, the main map with the extent of 1.25 size of the original extent is shown in place of it. If the second additional map is absent, the main map with the extent of 0.75 size of the original extent is shown in place of it. |
Site Details Map | This report template supports a portrait report with a main map and an additional information about the area mapped. The map legend isn't supported with this template. The additional information is specified with the Data property of the report parameters as an array of key/value pairs. The following keys are available for this report: "City", "State", "ZIP", "County", "CBSA", "Tract", and "BlockGroup". |
The example below generates a Map Report Landscape with a polygon and a legend. Also, the report is saved to the 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. // ========= Prepare map objects. // Specify the spatial reference for analysis SpatialReference spatialReference = new GeographicCoordinateSystem(); spatialReference.WKID = 4326; spatialReference.WKIDSpecified = true; // Specify the extent EnvelopeN envelope = new EnvelopeN(); envelope.XMin = -122.5; envelope.XMax = -122.38; envelope.YMin = 37.67; envelope.YMax = 37.83; envelope.SpatialReference = spatialReference; MapExtent mapExtent = new MapExtent(); mapExtent.Extent = envelope; // Specify coordinates of a custom polygon to be drawn on the map PolygonN polygon = new PolygonN(); Ring ring = new Ring(); ring.PointArray = new Point[5]; PointN point; point = new PointN(); point.X = -122.45; point.Y = 37.8; ring.PointArray[0] = point; point = new PointN(); point.X = -122.41; point.Y = 37.8; ring.PointArray[1] = point; point = new PointN(); point.X = -122.41; point.Y = 37.7; ring.PointArray[2] = point; point = new PointN(); point.X = -122.45; point.Y = 37.7; ring.PointArray[3] = point; point = new PointN(); point.X = -122.45; point.Y = 37.8; ring.PointArray[4] = point; polygon.RingArray = new Ring[] { ring }; // Specify an outline symbol for the custom polygon RgbColor lineColor = new RgbColor(); lineColor.Red = 0x24; lineColor.Green = 0x24; lineColor.Blue = 0xC7; lineColor.AlphaValue = 200; SimpleLineSymbol outlineSymbol = new SimpleLineSymbol(); outlineSymbol.Color = lineColor; outlineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; outlineSymbol.Width = 2; // Specify a fill symbol for the custom polygon RgbColor fillColor = new RgbColor(); fillColor.Red = 0xC7; fillColor.Green = 0x37; fillColor.Blue = 0x24; fillColor.AlphaValue = 50; SimpleFillSymbol fillSymbol = new SimpleFillSymbol(); fillSymbol.Color = fillColor; fillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; fillSymbol.Outline = outlineSymbol; // Specify the custom polygon PolygonElement customPolygon = new PolygonElement(); customPolygon.Polygon = polygon; customPolygon.Symbol = fillSymbol; customPolygon.Type = "PolygonElement"; // ========= Specify the main map Map map = new Map(); map.MapArea = mapExtent; map.RenderScalebar = true; // The scale bar will be shown on the main map BAMapDescription mapDesc = new BAMapDescription(); mapDesc.MapURL = "http://services.arcgisonline.com/ArcGIS/services/World_Imagery/MapServer"; mapDesc.CustomGraphics = new GraphicElement[] { customPolygon }; map.MapDescriptions = new BAMapDescription[] { mapDesc }; // ========= Specify report parameters MapReportParameters parameters = new MapReportParameters(); parameters.Maps = new Map[] { map }; // Specify the legend parameters.MapReportLegendInfo = new MapReportLegendInfo(); parameters.MapReportLegendInfo.Title = "Adults: Watch TV aired once/wk: American Idol by States"; MapReportLegendItem[] legendItems = new MapReportLegendItem[5]; legendItems[0] = new MapReportLegendItem(); legendItems[0].Color = "#FFFFB2"; legendItems[0].Label = "829,641 - 3,093,338"; legendItems[1] = new MapReportLegendItem(); legendItems[1].Color = "#FECC5C"; legendItems[1].Label = "491,877 - 829,640"; legendItems[2] = new MapReportLegendItem(); legendItems[2].Color = "#FD8D3C"; legendItems[2].Label = "256,916 - 491,876"; legendItems[3] = new MapReportLegendItem(); legendItems[3].Color = "#F03B20"; legendItems[3].Label = "120,569 - 256,915"; legendItems[4] = new MapReportLegendItem(); legendItems[4].Color = "#BD0026"; legendItems[4].Label = "46,454 - 120,568"; parameters.MapReportLegendInfo.MapReportLegendItems = legendItems; // Set report options ReportOptions reportOptions = new ReportOptions(); reportOptions.ReportFormat = "PDF"; reportOptions.TemplateName = "Map Report Landscape"; reportOptions.ReportHeader = new KeyValue[6]; reportOptions.ReportHeader[0] = new KeyValue(); reportOptions.ReportHeader[0].Key = "subtitle"; reportOptions.ReportHeader[0].Value = "Custom Report Title"; reportOptions.ReportHeader[1] = new KeyValue(); reportOptions.ReportHeader[1].Key = "locationname"; reportOptions.ReportHeader[1].Value = "Location Name"; reportOptions.ReportHeader[2] = new KeyValue(); reportOptions.ReportHeader[2].Key = "address"; reportOptions.ReportHeader[2].Value = "Address"; reportOptions.ReportHeader[3] = new KeyValue(); reportOptions.ReportHeader[3].Key = "latitude"; reportOptions.ReportHeader[3].Value = "Latitude"; reportOptions.ReportHeader[4] = new KeyValue(); reportOptions.ReportHeader[4].Key = "longitude"; reportOptions.ReportHeader[4].Value = "Longitude"; reportOptions.ReportHeader[5] = new KeyValue(); reportOptions.ReportHeader[5].Key = "areadesc2"; reportOptions.ReportHeader[5].Value = "Area Description"; reportOptions.ReportFooter = new KeyValue[5]; reportOptions.ReportFooter[0] = new KeyValue(); reportOptions.ReportFooter[0].Key = "ProductLabel"; reportOptions.ReportFooter[0].Value = "Custom Label"; reportOptions.ReportFooter[1] = new KeyValue(); reportOptions.ReportFooter[1].Key = "ProductUrl"; reportOptions.ReportFooter[1].Value = "www.company.com/home"; reportOptions.ReportFooter[2] = new KeyValue(); reportOptions.ReportFooter[2].Key = "PhoneNumber"; reportOptions.ReportFooter[2].Value = "000000000"; reportOptions.ReportFooter[3] = new KeyValue(); reportOptions.ReportFooter[3].Key = "TrialUrlText"; reportOptions.ReportFooter[3].Value = "Try it Now!"; reportOptions.ReportFooter[4] = new KeyValue(); reportOptions.ReportFooter[4].Key = "TrialUrl"; reportOptions.ReportFooter[4].Value = "http://www.company.com/trial"; parameters.StandardReportOptions = reportOptions; // 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 outputReport = new esriFolderItem(); outputReport.folderType = esriFolderType.esriFolderReports; outputReport.itemName = "report_MapReport"; outputReport.projectName = "Default Project"; outputReport.workspaceName = "Default Workspace"; // Execute the task. // USER NOTE: This example takes some time. // You may have to adjust the response timeout on the client. // In .NET, this can be set with the WebClientProtocol.Timeout property. baServerHelper.Client.Timeout = 300000; // 300,000 milliseconds (5 minutes) TaskResultOutput result = baServerHelper.MapReport(parameters, outputReport); // Get the report URL string reportURL = result.Reports[0].ReportURL; |
The example below generates a Site Details Map.
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. // ========= Prepare map objects. // Specify the spatial reference for analysis SpatialReference spatialReference = new GeographicCoordinateSystem(); spatialReference.WKID = 4326; spatialReference.WKIDSpecified = true; // Specify the extent EnvelopeN envelope = new EnvelopeN(); envelope.XMin = -122.5; envelope.XMax = -122.38; envelope.YMin = 37.67; envelope.YMax = 37.83; envelope.SpatialReference = spatialReference; MapExtent mapExtent = new MapExtent(); mapExtent.Extent = envelope; // Specify coordinates of a custom polygon to be drawn on the map PolygonN polygon = new PolygonN(); Ring ring = new Ring(); ring.PointArray = new Point[5]; PointN point; point = new PointN(); point.X = -122.45; point.Y = 37.8; ring.PointArray[0] = point; point = new PointN(); point.X = -122.41; point.Y = 37.8; ring.PointArray[1] = point; point = new PointN(); point.X = -122.41; point.Y = 37.7; ring.PointArray[2] = point; point = new PointN(); point.X = -122.45; point.Y = 37.7; ring.PointArray[3] = point; point = new PointN(); point.X = -122.45; point.Y = 37.8; ring.PointArray[4] = point; polygon.RingArray = new Ring[] { ring }; // Specify an outline symbol for the custom polygon RgbColor lineColor = new RgbColor(); lineColor.Red = 0x24; lineColor.Green = 0x24; lineColor.Blue = 0xC7; lineColor.AlphaValue = 200; SimpleLineSymbol outlineSymbol = new SimpleLineSymbol(); outlineSymbol.Color = lineColor; outlineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; outlineSymbol.Width = 2; // Specify a fill symbol for the custom polygon RgbColor fillColor = new RgbColor(); fillColor.Red = 0xC7; fillColor.Green = 0x37; fillColor.Blue = 0x24; fillColor.AlphaValue = 50; SimpleFillSymbol fillSymbol = new SimpleFillSymbol(); fillSymbol.Color = fillColor; fillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; fillSymbol.Outline = outlineSymbol; // Specify the custom polygon PolygonElement customPolygon = new PolygonElement(); customPolygon.Polygon = polygon; customPolygon.Symbol = fillSymbol; customPolygon.Type = "PolygonElement"; // ========= Specify the main map Map map = new Map(); map.MapArea = mapExtent; map.RenderScalebar = true; // The scale bar will be shown on the main map BAMapDescription mapDesc = new BAMapDescription(); mapDesc.MapURL = "http://services.arcgisonline.com/ArcGIS/services/World_Imagery/MapServer"; mapDesc.CustomGraphics = new GraphicElement[] { customPolygon }; map.MapDescriptions = new BAMapDescription[] { mapDesc }; // ========= Specify report parameters MapReportParameters parameters = new MapReportParameters(); parameters.Maps = new Map[] { map }; // Specify site details data PropertySetProperty[] dataProperties = new PropertySetProperty[7]; dataProperties[0] = new PropertySetProperty(); dataProperties[0].Key = "City"; dataProperties[0].Value = "San Francisco"; dataProperties[1] = new PropertySetProperty(); dataProperties[1].Key = "State"; dataProperties[1].Value = "California"; dataProperties[2] = new PropertySetProperty(); dataProperties[2].Key = "ZIP"; dataProperties[2].Value = "94114"; dataProperties[3] = new PropertySetProperty(); dataProperties[3].Key = "County"; dataProperties[3].Value = "San Francisco County"; dataProperties[4] = new PropertySetProperty(); dataProperties[4].Key = "CBSA"; dataProperties[4].Value = "Riverside-San Bernardino-Ontario, CA Metropolitan Statistical Area"; dataProperties[5] = new PropertySetProperty(); dataProperties[5].Key = "Tract"; dataProperties[5].Value = "060730083.15"; dataProperties[6] = new PropertySetProperty(); dataProperties[6].Key = "BlockGroup"; dataProperties[6].Value = "060730083.151"; parameters.Data = new PropertySet(); parameters.Data.PropertyArray = dataProperties; // Set report options ReportOptions reportOptions = new ReportOptions(); reportOptions.ReportFormat = "PDF"; reportOptions.TemplateName = "Site Details Map"; reportOptions.ReportHeader = new KeyValue[6]; reportOptions.ReportHeader[0] = new KeyValue(); reportOptions.ReportHeader[0].Key = "subtitle"; reportOptions.ReportHeader[0].Value = "Custom Report Title"; reportOptions.ReportHeader[1] = new KeyValue(); reportOptions.ReportHeader[1].Key = "locationname"; reportOptions.ReportHeader[1].Value = "Location Name"; reportOptions.ReportHeader[2] = new KeyValue(); reportOptions.ReportHeader[2].Key = "address"; reportOptions.ReportHeader[2].Value = "Address"; reportOptions.ReportHeader[3] = new KeyValue(); reportOptions.ReportHeader[3].Key = "latitude"; reportOptions.ReportHeader[3].Value = "Latitude"; reportOptions.ReportHeader[4] = new KeyValue(); reportOptions.ReportHeader[4].Key = "longitude"; reportOptions.ReportHeader[4].Value = "Longitude"; reportOptions.ReportHeader[5] = new KeyValue(); reportOptions.ReportHeader[5].Key = "areadesc2"; reportOptions.ReportHeader[5].Value = "Area Description"; reportOptions.ReportFooter = new KeyValue[5]; reportOptions.ReportFooter[0] = new KeyValue(); reportOptions.ReportFooter[0].Key = "ProductLabel"; reportOptions.ReportFooter[0].Value = "Custom Label"; reportOptions.ReportFooter[1] = new KeyValue(); reportOptions.ReportFooter[1].Key = "ProductUrl"; reportOptions.ReportFooter[1].Value = "www.company.com/home"; reportOptions.ReportFooter[2] = new KeyValue(); reportOptions.ReportFooter[2].Key = "PhoneNumber"; reportOptions.ReportFooter[2].Value = "000000000"; reportOptions.ReportFooter[3] = new KeyValue(); reportOptions.ReportFooter[3].Key = "TrialUrlText"; reportOptions.ReportFooter[3].Value = "Try it Now!"; reportOptions.ReportFooter[4] = new KeyValue(); reportOptions.ReportFooter[4].Key = "TrialUrl"; reportOptions.ReportFooter[4].Value = "http://www.company.com/trial"; parameters.StandardReportOptions = reportOptions; // Set other parameters esriFolderItem outputReport = null; // Execute the task. // USER NOTE: This example takes some time. // You may have to adjust the response timeout on the client. // In .NET, this can be set with the WebClientProtocol.Timeout property. baServerHelper.Client.Timeout = 300000; // 300,000 milliseconds (5 minutes) TaskResultOutput result = baServerHelper.MapReport(parameters, outputReport); // Get the report URL string reportURL = result.Reports[0].ReportURL; |
The example below generates a Site Map Report.
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. // ========= Prepare objects used in all maps. // Specify the spatial reference for analysis SpatialReference spatialReference = new GeographicCoordinateSystem(); spatialReference.WKID = 4326; spatialReference.WKIDSpecified = true; // Specify the same extent for all maps EnvelopeN envelope = new EnvelopeN(); envelope.XMin = -85.86; envelope.XMax = -85.5; envelope.YMin = 38.1; envelope.YMax = 38.3; envelope.SpatialReference = spatialReference; MapExtent mapExtent = new MapExtent(); mapExtent.Extent = envelope; // Specify coordinates of a custom polygon to be drawn on maps PolygonN polygon = new PolygonN(); Ring ring = new Ring(); ring.PointArray = new Point[5]; PointN point; point = new PointN(); point.X = -85.7; point.Y = 38.2; ring.PointArray[0] = point; point = new PointN(); point.X = -85.6; point.Y = 38.2; ring.PointArray[1] = point; point = new PointN(); point.X = -85.6; point.Y = 38.15; ring.PointArray[2] = point; point = new PointN(); point.X = -85.7; point.Y = 38.15; ring.PointArray[3] = point; point = new PointN(); point.X = -85.7; point.Y = 38.2; ring.PointArray[4] = point; polygon.RingArray = new Ring[] { ring }; // Specify an outline symbol for the custom polygon RgbColor lineColor = new RgbColor(); lineColor.Red = 0x24; lineColor.Green = 0x24; lineColor.Blue = 0xC7; lineColor.AlphaValue = 200; SimpleLineSymbol outlineSymbol = new SimpleLineSymbol(); outlineSymbol.Color = lineColor; outlineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; outlineSymbol.Width = 2; // Specify a fill symbol for the custom polygon RgbColor fillColor = new RgbColor(); fillColor.Red = 0xC7; fillColor.Green = 0x37; fillColor.Blue = 0x24; fillColor.AlphaValue = 50; SimpleFillSymbol fillSymbol = new SimpleFillSymbol(); fillSymbol.Color = fillColor; fillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; fillSymbol.Outline = outlineSymbol; // Specify the custom polygon PolygonElement customPolygon = new PolygonElement(); customPolygon.Polygon = polygon; customPolygon.Symbol = fillSymbol; customPolygon.Type = "PolygonElement"; // ========= Specify the main map Map map1 = new Map(); map1.MapArea = mapExtent; map1.RenderScalebar = true; // The scale bar will be shown on the main map BAMapDescription mapDesc = new BAMapDescription(); mapDesc.MapURL = "http://services.arcgisonline.com/ArcGIS/services/World_Imagery/MapServer"; mapDesc.CustomGraphics = new GraphicElement[] { customPolygon }; map1.MapDescriptions = new BAMapDescription[] { mapDesc }; // ========= Specify the second map Map map2 = new Map(); map2.MapArea = mapExtent; mapDesc = new BAMapDescription(); mapDesc.MapURL = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/" + "ESRI_StateCityHighway_USA/MapServer"; mapDesc.CustomGraphics = new GraphicElement[] { customPolygon }; map2.MapDescriptions = new BAMapDescription[] { mapDesc }; // ========= Specify report parameters MapReportParameters parameters = new MapReportParameters(); // Specify array of maps. The third map is the same as the second one here. parameters.Maps = new Map[] { map1, map2, map2 }; // Set report options ReportOptions reportOptions = new ReportOptions(); reportOptions.ReportFormat = "PDF"; reportOptions.TemplateName = "Site Map Report"; reportOptions.ReportHeader = new KeyValue[1]; reportOptions.ReportHeader[0] = new KeyValue(); reportOptions.ReportHeader[0].Key = "subtitle"; reportOptions.ReportHeader[0].Value = "Custom Report Title"; reportOptions.ReportFooter = new KeyValue[5]; reportOptions.ReportFooter[0] = new KeyValue(); reportOptions.ReportFooter[0].Key = "ProductLabel"; reportOptions.ReportFooter[0].Value = "Custom Label"; reportOptions.ReportFooter[1] = new KeyValue(); reportOptions.ReportFooter[1].Key = "ProductUrl"; reportOptions.ReportFooter[1].Value = "www.company.com/home"; reportOptions.ReportFooter[2] = new KeyValue(); reportOptions.ReportFooter[2].Key = "PhoneNumber"; reportOptions.ReportFooter[2].Value = "000000000"; reportOptions.ReportFooter[3] = new KeyValue(); reportOptions.ReportFooter[3].Key = "TrialUrlText"; reportOptions.ReportFooter[3].Value = "Try it Now!"; reportOptions.ReportFooter[4] = new KeyValue(); reportOptions.ReportFooter[4].Key = "TrialUrl"; reportOptions.ReportFooter[4].Value = "http://www.company.com/trial"; parameters.StandardReportOptions = reportOptions; // Set other parameters esriFolderItem outputReport = null; // Execute the task. // USER NOTE: This example takes some time. // You may have to adjust the response timeout on the client. // In .NET, this can be set with the WebClientProtocol.Timeout property. baServerHelper.Client.Timeout = 300000; // 300,000 milliseconds (5 minutes) TaskResultOutput result = baServerHelper.MapReport(parameters, outputReport); // Get the report URL string reportURL = result.Reports[0].ReportURL; |