FRAMES | NO FRAMES
DriveTime Method

Creates trade areas based on the driving time or driving distance around store features.

Availability: Business Analyst Server, Business Analyst Online.

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

Parameter Description
Parameters Configuration options for trade area creation. Type DriveTimeParameters.
ReportFormat This parameter should be null. This parameter is deprecated. Available with Business Analyst Server.
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. Available with Business Analyst Server.
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

You can generate the drive time areas that use actual street networks and approximated driving times. Equal competition market areas do not adjust for the way people actually travel on the ground. Equal competition market areas are based on as the crow flies distances, while people in the real world have to use roads and streets. A two mile trip might take five minutes on one road network and 15 minutes on another.

Pizza delivery provides a good case example for the use of drive time polygons. A company may want to limit deliveries to a total of 15 minutes. This means that the delivery radius of each store would be restricted to a 6 minute drive time (six minutes to the delivery point, three minutes at the delivery site, and six minutes to return, for a total of 15 minutes).

Overlap can occur. Some store chains solve this problem by using equal competition areas where drive time overlap occurs, to make each service zone unique and using the drive times at the edge of the built up urban areas to restrict delivery distances and times.

Other examples of drive time areas include:

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 illustrates a workflow which includes generation of a drive time-based trade area around a store location and the creation of a Demographic and Income report based on this trade area. In addition to generating a report based on the area covered by the drive time trade area, the resulting drive time trade area layer and the store layer are saved to the repository.

NOTE: The signature of the BAServerHelper.DriveTime 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
 
// 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[1];
 
storeAddresses[0] = new RecordSetByAddress();
storeAddresses[0].Name = "store1";
storeAddresses[0].Description = "Houston Store";
storeAddresses[0].StoreID = "1";
storeAddresses[0].Address = "4800 Calhoun";
storeAddresses[0].City = "Houston";
storeAddresses[0].State = "TX";
storeAddresses[0].ZIP = "77004";
 
TaskResultOutput recordSetByAddressResult =
    baServerHelper.CreateRecordSetByAddresses(storeAddresses, esriFolderType.esriFolderStoreLayers);
 
TableData tableData = new TableData();
tableData.RecordSet = recordSetByAddressResult.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_DriveTime";
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: Execute the analysis
 
DriveTimeParameters parameters = new DriveTimeParameters();
 
// Set specific analysis parameters
parameters.DistanceUnits = esriBADriveTimeUnits.esriMiles;
parameters.Radii = new double[] { 1, 3, 5 };
parameters.StoreIDField = "STORE_ID";
parameters.Stores = storeLayer;
 
// Set summary report parameters
ReportOptions demoReport = new ReportOptions();
demoReport.ReportFormat = "PDF";
demoReport.TemplateName = "Demographic and Income Report";
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 = "tradeArea_DriveTime";
outputLayer.projectName = "Default Project";
outputLayer.workspaceName = "Default Workspace";
 
TaskResultOutput result = baServerHelper.DriveTime(parameters, imageOptions, outputOptions, outputLayer, outputReport);
 
string reportURL = result.Reports[0].ReportURL;

See Also