FRAMES | NO FRAMES
SpatialOverlay Method

Aggregates data from a geographic layer with another layer.

Availability: Business Analyst Server.

TaskResultOutput SpatialOverlay ( 
    SpatialOverlayParameters  Parameters, 
    RenderingParameters       RenderingParameters, 
    TaskOutputType[]          OutputTypes, 
    esriFolderItem            OutputAnalysisItem 
);

Parameter Description
Parameters Configuration options for analysis. Type SpatialOverlayParameters.
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) and creating a feature layer for subsequent analysis (GetFeatureClass). 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.

Returns

Variable of type TaskResultOutput

Remarks

The SpatialOverlay method allows you to summarize demographic data for a set of custom trade areas and add summarized values as attribute fields to the output feature layer.

Usage Tips

Examples

The example below demonstrates execution of an overlay analysis on a trade area. Selected attribute variables are summarized over the overlaid areas.

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 a simple ring around a store
 
PointRecord[] storePoints = new PointRecord[1];
 
storePoints[0] = new PointRecord();
storePoints[0].Name = "store_study_site";
storePoints[0].Description = "Store Study Site";
storePoints[0].StoreID = "1";
storePoints[0].Latitude = 34.057596;
storePoints[0].Longitude = -117.195683;
 
// Create a store feature layer based on an array of point records.
PointLayer storeLayer = new PointLayer();
storeLayer.Points = storePoints;
 
SimpleRingsParameters simpleRingsParameters = new SimpleRingsParameters();
 
// Set specific analysis parameters
simpleRingsParameters.DistanceUnits = esriUnits.esriMiles;
simpleRingsParameters.Radii = new double[] { 1 };
simpleRingsParameters.SingleStoreID = "1";
simpleRingsParameters.Stores = storeLayer;
 
// StoreIDField is useless for stores specified with array of PointRecord
//simpleRingsParameters.StoreIDField = "STORE_ID";
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
outputLayer = null;
outputReport = null;
 
TaskResultOutput simpleRingsResult =
    baServerHelper.SimpleRings(simpleRingsParameters, imageOptions, outputOptions, outputLayer, outputReport);
 
DataLayer boundaryLayer = new DataLayer();
boundaryLayer.RecordSet = simpleRingsResult.RecordSet;
 
// ========= STEP 2: Execute the analysis
 
SpatialOverlayParameters parameters = new SpatialOverlayParameters();
 
// Set specific analysis parameters
parameters.AreaIDField = "AREA_ID";
parameters.Boundaries = boundaryLayer;
parameters.Summarizations = new string[] { "TOTHH_CY" };
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
outputLayer = null;
 
TaskResultOutput result = baServerHelper.SpatialOverlay(parameters, imageOptions, outputOptions, outputLayer);

See Also