FRAMES | NO FRAMES
Grids Method

Generates an equidistant vector-based grid network for a specified area.

Availability: Business Analyst Server.

TaskResultOutput Grids ( 
    GridsParameters      Parameters, 
    esriReportFormat     ReportFormat, 
    RenderingParameters  RenderingParameters, 
    TaskOutputType[]     OutputTypes, 
    esriFolderItem       OutputAnalysisItem, 
    esriFolderItem[]     OutputReportItems
);

Parameter Description
Parameters Configuration options for analysis. Type GridsParameters.
ReportFormat This parameter should be null. This parameter is deprecated.
RenderingParameters Configuration options for rendering output when GetMapImage option is specified in the OutputTypes parameter. Type RenderingParameters.
OutputTypes Array of task output options. Options for this method include rendering output image (GetMapImage), creating a feature layer for subsequent analysis (GetFeatureClass), and creating a report (GetReport). Type TaskOutputType[].
OutputAnalysisItem (Optional parameter — can be null).
Configuration options for storing the output feature layer in the repository. This will enable viewing and working with the output result in subsequent tasks. Type esriFolderItem.
OutputReportItems (Optional parameter - can be null).
Array of configuration options for storing the output reports in the repository. This will enable viewing and working with the output result in subsequent tasks. Type esriFolderItem[]. Available with Business Analyst Server 10.0.

Returns

Variable of type TaskResultOutput

Remarks

Grids are created by collecting a geographic extent (envelope) and a grid size in a predefined unit of measurement. The Grids method is used to create a vector based graticule layer for a given area. You can aggregate demographic information (or other Business Analyst data) for each grid cell. For example, you can aggregate based on the total population or average household income for each cell.

The purpose of the Grids method is to examine and compare variables in different cells. Often referred to as "hot spot analysis", grid cells are of equal size and area and show comparisons in different areas.

The image below has the total households for each grid cell thematically shaded. By utilizing grid cells, the household values are normalized for comparison purposes.

NOTE: Since Business Analyst Server 10.0, the OutputReportItem parameter is replaced with the OutputReportItems parameter which is an array of folder items. The number of items in this array should be equal to the number of items in the ReportOptions array.

Usage Tips

Examples

The example below creates a county-wide trade area using the FIPS county code for San Francisco County with the StandardLevelsOfGeography method. Then, it uses the county analysis extent and creates a user-defined grid over the area to summarize selected demographic variables. A grid overlay feature layer with data summarized for each grid cell is generated and saved to the repository.

NOTE: The signature of the BAServerHelper.Grids method is made compatible with the previous version of this method—the OutputReportItems parameter is specified with the params keyword allowing users to pass output report items in the variable-length list of parameters.

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
 
RenderingParameters imageOptions;
TaskOutputType[] outputOptions;
esriFolderItem outputLayer;
esriFolderItem outputReport;
 
// ========= STEP 1: Create an analysis extent for San Francisco County
 
StandardLevelsOfGeographyParameters geographyParameters = new StandardLevelsOfGeographyParameters();
 
// Set specific analysis parameters
geographyParameters.GeographyFeaturesBehavior = esriStdGeographyType.esriStdGeographyTypeFirst;
geographyParameters.GeographyIDs = new string[] { "06075" }; // FIPS ID code for San Francisco County
geographyParameters.GeographyLevelID = "US.Counties";
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
outputLayer = null;
outputReport = null;
 
TaskResultOutput geographyResult =
    baServerHelper.StandardLevelsOfGeography(geographyParameters, imageOptions, outputOptions, outputLayer, outputReport);
 
PolygonN polygon = (PolygonN)geographyResult.RecordSet.Records[0].Values[1];
ExtentData extentData = new ExtentData();
extentData.Extent = polygon.Extent;
 
// ========= STEP 2: Execute the analysis
 
GridsParameters parameters = new GridsParameters();
parameters.AnalysisExtent = extentData;
parameters.DistanceUnits = esriUnits.esriMiles;
parameters.GridCellSize = 1;
parameters.Summarizations = new string[] { "TOTHH_CY", "TOTHH_FY" };
parameters.SymbolizationField = "TOTHH_CY";
 
// Set summary report parameters
ReportOptions demoReport = new ReportOptions();
demoReport.ReportFormat = "PDF";
demoReport.TemplateName = "Demographic and Income Report";
demoReport.AreaTitleField = "TA_DESC";
parameters.ReportOptions = new ReportOptions[] { demoReport };
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass, TaskOutputType.GetReport };
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.
outputLayer = new esriFolderItem();
outputLayer.folderType = esriFolderType.esriFolderTradeAreas;
outputLayer.itemName = "analysisLayer_Grids";
outputLayer.projectName = "Default Project";
outputLayer.workspaceName = "Default Workspace";
 
TaskResultOutput result = baServerHelper.Grids(parameters, imageOptions, outputOptions, outputLayer, outputReport);
 
string reportURL = result.Reports[0].ReportURL;

See Also