FRAMES | NO FRAMES
PointsInPolygonReport Method

Creates a report on distribution of points within polygons.

Availability: Business Analyst Server 9.3.1.

TaskResultOutput PointsInPolygonReport ( 
    PointsInPolygonReportParameters  Parameters, 
    esriReportFormat                 ReportFormat, 
    TaskOutputType[]                 OutputTypes, 
    esriFolderItem                   OutputReportItem 
);

Parameter Description
Parameters Configuration options for analysis. Type PointsInPolygonReportParameters.
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.

Returns

Variable of type TaskResultOutput

Examples

The example below generates a report on distribution customers within simple rings around stores. Also, the store layer, the customer layer, and the trade area layer are all 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.
 
RenderingParameters imageOptions;
TaskOutputType[] outputOptions;
esriFolderItem outputLayer;
esriFolderItem outputReport;
 
// ========= STEP 1: Create a record set by store addresses
 
RecordSetByAddress[] storeAddresses = new RecordSetByAddress[2];
 
storeAddresses[0] = new RecordSetByAddress();
storeAddresses[0].Name = "location1";
storeAddresses[0].Description = "Downtown Location";
storeAddresses[0].StoreID = "1";
storeAddresses[0].Address = "1401 Kettner Blvd.";
storeAddresses[0].City = "San Diego";
storeAddresses[0].State = "CA";
storeAddresses[0].ZIP = "92101";
 
storeAddresses[1] = new RecordSetByAddress();
storeAddresses[1].Name = "location2";
storeAddresses[1].Description = "Clairemont Location";
storeAddresses[1].StoreID = "2";
storeAddresses[1].Address = "5407 Balboa Ave.";
storeAddresses[1].City = "San Diego";
storeAddresses[1].State = "CA";
storeAddresses[1].ZIP = "92111";
 
TaskResultOutput storeRecordSetResult =
    baServerHelper.CreateRecordSetByAddresses(storeAddresses, esriFolderType.esriFolderStoreLayers);
 
TableData tableData = new TableData();
tableData.RecordSet = storeRecordSetResult.RecordSet;
GeocodeData geocodeData = new GeocodeData();
geocodeData.Table = tableData;
 
// ========= STEP 2: Geocode the record set with stores
 
CustomerStoreSetupByGeocodeTableParameters geocodeParameters = new CustomerStoreSetupByGeocodeTableParameters();
 
// Set specific analysis parameters
geocodeParameters.GeocodeCustomers = false;
geocodeParameters.GeocodeData = geocodeData;
geocodeParameters.NameField = "NAME";
geocodeParameters.StoreIDField = "STORE_ID";
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
 
// 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.esriFolderStoreLayers;
outputLayer.itemName = "storeLayer_PointsInPolygonReport";
outputLayer.workspaceName = "Default Workspace";
outputLayer.projectName = "Default Project";
 
TaskResultOutput storeGeocodeResult =
    baServerHelper.CustomerStoreSetupByGeocodeTable(geocodeParameters, imageOptions, outputOptions, outputLayer);
 
PointLayer storeLayer = new PointLayer();
storeLayer.RecordSet = storeGeocodeResult.RecordSet;
 
// ========= STEP 3: Create simple rings around stores
 
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[] { TaskOutputType.GetFeatureClass };
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 = "tradeArea_PointsInPolygonReport";
outputLayer.workspaceName = "Default Workspace";
outputLayer.projectName = "Default Project";
 
TaskResultOutput simpleRingsResult =
    baServerHelper.SimpleRings(simpleRingsParameters, imageOptions, outputOptions, outputLayer, outputReport);
 
DataLayer boundaryLayer = new DataLayer();
boundaryLayer.RecordSet = simpleRingsResult.RecordSet;
 
// ========= STEP 4: Create a record set by customer addresses
 
RecordSetByAddress[] customerAddresses = new RecordSetByAddress[7];
 
customerAddresses[0] = new RecordSetByAddress();
customerAddresses[0].Name = "customer1";
customerAddresses[0].Description = "Ocean Beach Customer";
customerAddresses[0].StoreID = "1";
customerAddresses[0].Address = "5080 Newport Ave.";
customerAddresses[0].City = "San Diego";
customerAddresses[0].State = "CA";
customerAddresses[0].ZIP = "92107";
customerAddresses[0].CustomerID = "1";
 
customerAddresses[1] = new RecordSetByAddress();
customerAddresses[1].Name = "customer2";
customerAddresses[1].Description = "La Jolla Customer";
customerAddresses[1].StoreID = "1";
customerAddresses[1].Address = "1250 Prospect St.";
customerAddresses[1].City = "La Jolla";
customerAddresses[1].State = "CA";
customerAddresses[1].ZIP = "92037";
customerAddresses[1].CustomerID = "2";
 
customerAddresses[2] = new RecordSetByAddress();
customerAddresses[2].Name = "customer3";
customerAddresses[2].Description = "Pacific Beach Customer";
customerAddresses[2].StoreID = "1";
customerAddresses[2].Address = "1762 Garnet Ave.";
customerAddresses[2].City = "San Diego";
customerAddresses[2].State = "CA";
customerAddresses[2].ZIP = "92109";
customerAddresses[2].CustomerID = "3";
 
customerAddresses[3] = new RecordSetByAddress();
customerAddresses[3].Name = "customer4";
customerAddresses[3].Description = "Morena Customer";
customerAddresses[3].StoreID = "2";
customerAddresses[3].Address = "1240 W. Morena Blvd.";
customerAddresses[3].City = "San Diego";
customerAddresses[3].State = "CA";
customerAddresses[3].ZIP = "92111";
customerAddresses[3].CustomerID = "4";
 
customerAddresses[4] = new RecordSetByAddress();
customerAddresses[4].Name = "customer5";
customerAddresses[4].Description = "Clairemont Customer";
customerAddresses[4].StoreID = "2";
customerAddresses[4].Address = "6393 Balboa Ave.";
customerAddresses[4].City = "San Diego";
customerAddresses[4].State = "CA";
customerAddresses[4].ZIP = "92111";
customerAddresses[4].CustomerID = "5";
 
customerAddresses[5] = new RecordSetByAddress();
customerAddresses[5].Name = "customer6";
customerAddresses[5].Description = "Bird Rock Customer";
customerAddresses[5].StoreID = "2";
customerAddresses[5].Address = "5735 La Jolla Blvd.";
customerAddresses[5].City = "La Jolla";
customerAddresses[5].State = "CA";
customerAddresses[5].ZIP = "92037";
customerAddresses[5].CustomerID = "6";
 
customerAddresses[6] = new RecordSetByAddress();
customerAddresses[6].Name = "customer7";
customerAddresses[6].Description = "University City Customer";
customerAddresses[6].StoreID = "1";
customerAddresses[6].Address = "3254 Governor Dr.";
customerAddresses[6].City = "San Diego";
customerAddresses[6].State = "CA";
customerAddresses[6].ZIP = "92122";
customerAddresses[6].CustomerID = "7";
 
TaskResultOutput customerRecordSetResult =
    baServerHelper.CreateRecordSetByAddresses(customerAddresses, esriFolderType.esriFolderCustomerLayers);
 
tableData = new TableData();
tableData.RecordSet = customerRecordSetResult.RecordSet;
geocodeData = new GeocodeData();
geocodeData.Table = tableData;
 
// ========= STEP 5: Geocode the record set with customers
 
geocodeParameters = new CustomerStoreSetupByGeocodeTableParameters();
 
// Set specific analysis parameters
geocodeParameters.GeocodeCustomers = true;
geocodeParameters.GeocodeData = geocodeData;
geocodeParameters.LinkField = "STORE_ID";
geocodeParameters.NameField = "NAME";
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
 
// 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.esriFolderCustomerLayers;
outputLayer.itemName = "customerLayer_PointsInPolygonReport";
outputLayer.workspaceName = "Default Workspace";
outputLayer.projectName = "Default Project";
 
TaskResultOutput customerGeocodeResult =
    baServerHelper.CustomerStoreSetupByGeocodeTable(geocodeParameters, imageOptions, outputOptions, outputLayer);
 
PointLayer customerLayer = new PointLayer();
customerLayer.RecordSet = customerGeocodeResult.RecordSet;
 
// ========= STEP 6: Execute the analysis
 
PointsInPolygonReportParameters parameters = new PointsInPolygonReportParameters();
 
// Set specific analysis parameters
parameters.BoundaryIDField = "AREA_ID";
parameters.BoundaryLayer = boundaryLayer;
parameters.FeatureLayer = customerLayer;
parameters.AdditionalFields = new string[] { "DESCR", "ADDRESS" };
 
// Set report options
ReportOptions reportOptions = new ReportOptions();
reportOptions.ReportFormat = "PDF";
reportOptions.ReportHeader = new KeyValue[1];
reportOptions.ReportHeader[0] = new KeyValue();
reportOptions.ReportHeader[0].Key = "subtitle";
reportOptions.ReportHeader[0].Value = "Points in Polygon Report for customers and rings around stores";
parameters.StandardReportOptions = reportOptions;
 
// Set other parameters
outputReport = null;
 
TaskResultOutput result = baServerHelper.PointsInPolygonReport(parameters, outputReport);
 
string reportURL = result.Reports[0].ReportURL;

See Also