FRAMES | NO FRAMES
DriveTime Method

Create drive time or drive distance-based trade/service areas and summarize their underlying demographics and market characteristics with a library of reports.

TaskResultOutput DriveTime ( 
    DriveTimeParameters 	Parameters, 
    RenderingParameters 	RenderingParameters, 
    TaskOutputType[] 	OutputTypes 
);

Parameter Description
Parameters Configuration options for trade area creation. Type DriveTimeParameters.
RenderingParameters (currently unsupported) 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 creating the feature class for subsequent analysis (GetFeatureClass), and creating a report (GetReport). Type TaskOutputType[].

Returns

Variable of type TaskResultOutput.

The Drive Time service creates driving distance or driving time-based analysis areas around point features such as businesses, hospitals, schools, etc. The result of this service is a TaskResultOutput object. Optional analysis, which can be requested simultaneously, includes the creation of Summary Reports based on the resulting Drive Time analysis areas.

The Drive Time service can be leveraged to create Summary Reports in PDF, XML, or S.XML (Simplified XML) report formats. These options enable creation of presentation-ready reports or analysis output that can be easily integrated into other systems, applications, workflows, or report generation tools.

S.XML (Simplified XML) Report Output:


Remarks

Drive time analysis areas use street networks and approximate driving times based on attributes associated with the traversed streets around the Drive Time origins or point features. These origins may be point features such as a businesses, store fronts, organizations, agencies, hospitals, or service centers that may serve the area or region, and may have competitors or affiliates nearby. The output of the Drive Time service differs significantly from Simple Rings-generated areas, which define these areas based on straight-line ("as the crow flies") distances from the origin points.

Some applications of Drive Time include the following:

Usage Tips


 

Examples


Example 1: Generate and analyze drive time trade areas around 3 store features.

Notes: Example 1 demonstrates the use of the BAOReportHelper class. For information about code that consumes the BAOReport proxy class, (generated from the WSDL ) without leveraging the BAOReportHelper class, please refer to the BAOReport vs BAOReportHelper comparison chart and see the additional Examples below.

Download complete source code as Visual Studio solution to immediately execute samples. (See DriveTimeExamples.driveTimeExample1 in source.)

Output Report Created with Example

Click to download actual output file

Click to download actual output file

Example (1) Code
C#
// Authentication: Uses BAOReportHelper class for token management.

// Instantiate BAOReportHelper class
string tokenServiceUrl = "https://baoapi.esri.com/bawebservices/rest/authentication";

// Business Analyst Online API Sample credentials.
// NOTE: These credentials are associated with an 
// account which constrains analysis to the
// two ZIP codes in Redlands, CA.
string username = "BAOAPISAMPLE"; // Substitute user name here
string password = "baoapisample"; // Substitute password here

ITokenProvider tokenProvider = new HTTPTokenProvider(tokenServiceUrl, username, password);
BAOReportHelper baoReportHelper = new BAOReportHelper(tokenProvider);

// Create store points
PointRecord[] points = new PointRecord[2];

points[0] = new PointRecord();
points[0].Name = "redlands1";
points[0].Description = "Redlands Store 1";
points[0].StoreID = "1";
points[0].Latitude = 34.030637;
points[0].Longitude = -117.190671;

points[1] = new PointRecord();
points[1].Name = "redlands2";
points[1].Description = "Redlands Store 2";
points[1].StoreID = "2";
points[1].Latitude = 34.081008;
points[1].Longitude = -117.148639;

// Create a store feature layer based on an array of point records
PointLayer storeLayer = new PointLayer();
storeLayer.Points = points;

// Specify the spatial reference for WGS_1984 coordinate system
storeLayer.SpatialReference = new GeographicCoordinateSystem();
storeLayer.SpatialReference.WKID = 4326;
storeLayer.SpatialReference.WKIDSpecified = true;

// Specify report options
ReportOptions ro1 = new ReportOptions();
ro1.ReportFormat = "PDF";
ro1.ReportHeader = null;
ro1.TemplateName = "agesex";

ReportOptions ro2 = new ReportOptions();
ro2.ReportFormat = "PDF";
ro2.ReportHeader = new KeyValue[1];
ro2.ReportHeader[0] = new KeyValue();
ro2.ReportHeader[0].Key = "subtitle";
ro2.ReportHeader[0].Value = "My Subtitle";
ro2.TemplateName = "dandi";

// Specify parameters of DriveTime task
DriveTimeParameters parameters = new DriveTimeParameters();
parameters.ReportOptions = new ReportOptions[] { ro1, ro2 };
parameters.DistanceUnits = esriBADriveTimeUnits.esriMiles;
// The Donut option will result in donut-style rings of
// 0-3 miles, 3-4 miles, and 4-5 miles in this request.
// (If the Donut property was set to false, the rings
// would be 0-3 miles, 0-4 miles and 0-5 miles.)
parameters.Donut = true;
parameters.Radii = new double[] { 1, 3, 5 };
parameters.StoreIDField = "STORE_ID";
parameters.Stores = storeLayer;

// Specify task output types
TaskOutputType[] outputOptions = new TaskOutputType[] {TaskOutputType.GetFeatureClass, TaskOutputType.GetReport };

// Execute the task
TaskResultOutput result = baoReportHelper.DriveTime(parameters, null, outputOptions);

// There are now 3 donut drive distance areas around each of the store features
// specified in the result.RecordSet data layer.
// The result.Reports property contains an array of generated reports.

Example (1) Code
VB.NET
' Authentication: Uses BAOReportHelper class for token management.

' Instantiate BAOReportHelper class
Dim tokenServiceUrl As String = "https://baoapi.esri.com/bawebservices/rest/authentication"

' Business Analyst Online API Sample credentials.
' NOTE: These credentials are associated with an 
' account which constrains analysis to the
' two ZIP codes in Redlands, CA.
Dim username As String = "BAOAPISAMPLE"
' Substitute user name here
Dim password As String = "baoapisample"
' Substitute password here
Dim tokenProvider As ITokenProvider = New HTTPTokenProvider(tokenServiceUrl, username, password)
Dim baoReportHelper As New BAOReportHelper(tokenProvider)

' Create store points
Dim points As PointRecord() = New PointRecord(1) {}

points(0) = New PointRecord()
points(0).Name = "redlands1"
points(0).Description = "Redlands Store 1"
points(0).StoreID = "1"
points(0).Latitude = 34.030637
points(0).Longitude = -117.190671

points(1) = New PointRecord()
points(1).Name = "redlands2"
points(1).Description = "Redlands Store 2"
points(1).StoreID = "2"
points(1).Latitude = 34.081008
points(1).Longitude = -117.148639

' Create a store feature layer based on an array of point records
Dim storeLayer As New PointLayer()
storeLayer.Points = points

' Specify the spatial reference for WGS_1984 coordinate system
storeLayer.SpatialReference = New GeographicCoordinateSystem()
storeLayer.SpatialReference.WKID = 4326
storeLayer.SpatialReference.WKIDSpecified = True

' Specify report options
Dim ro1 As New ReportOptions()
ro1.ReportFormat = "PDF"
ro1.ReportHeader = Nothing
ro1.TemplateName = "agesex"

Dim ro2 As New ReportOptions()
ro2.ReportFormat = "PDF"
ro2.ReportHeader = New KeyValue(0) {}
ro2.ReportHeader(0) = New KeyValue()
ro2.ReportHeader(0).Key = "subtitle"
ro2.ReportHeader(0).Value = "My Subtitle"
ro2.TemplateName = "dandi"

' Specify parameters of DriveTime task
Dim parameters As New DriveTimeParameters()
parameters.ReportOptions = New ReportOptions() {ro1, ro2}
parameters.DistanceUnits = esriBADriveTimeUnits.esriMiles
' The Donut option will result in donut-style rings of
' 0-3 miles, 3-4 miles, and 4-5 miles in this request.
' (If the Donut property was set to false, the rings
' would be 0-3 miles, 0-4 miles and 0-5 miles.)
parameters.Donut = True
parameters.Radii = New Double() {1, 3, 5}
parameters.StoreIDField = "STORE_ID"
parameters.Stores = storeLayer

' Specify task output types
Dim outputOptions As TaskOutputType() = New TaskOutputType() {TaskOutputType.GetFeatureClass, TaskOutputType.GetReport}

' Execute the task
Dim result As TaskResultOutput = baoReportHelper.DriveTime(parameters, Nothing, outputOptions)

' There are now 3 donut drive distance areas around each of the store features
' specified in the result.RecordSet data layer.
' The result.Reports property contains an array of generated reports.

 

Example 2: Create 1, 3, and 5-minute Drive Time trade/service area rings around a store/origin point described by a PointLayer as FeatureSet and return the serialized feature class.

Notes: Example 2 demonstrates code which consumes the BAOReport proxy class (generated from the WSDL ) without leveraging the BAOReportHelper class. Please view Example 1 above for additional information about the BAOReportHelper class.

Download complete source code as Visual Studio solution to immediately execute samples. (See DriveTimeExamples.driveTimeExample2 in source.)

Example (2) Code
C#
// Authentication: Uses Authentication proxy class to generate token.

// Business Analyst Online API Sample credentials.
// NOTE: These credentials are associated with an 
// account which constrains analysis to the
// two ZIP codes in Redlands, CA.
string username = "BAOAPISAMPLE"; // Substitute user name here
string password = "baoapisample"; // Substitute password here

Authentication auth = new Authentication();
string token = auth.getToken(username, password);

SpatialReference gcs = new GeographicCoordinateSystem();
gcs.WKID = 4326;
gcs.WKIDSpecified = true;

// Define a geometry definition of the FeatureSet (Feature RecordSet)
GeometryDef geomDef = new GeometryDef();
geomDef.GeometryType = esriGeometryType.esriGeometryPoint;
geomDef.SpatialReference = gcs;

// Define the attribute fields of the FeatureSet
Field oidField = new Field();
oidField.Name = "OID";
oidField.AliasName = "Object ID";
oidField.Type = esriFieldType.esriFieldTypeOID;
Field shapeField = new Field();
shapeField.Name = "Shape";
shapeField.AliasName = "Geometry";
shapeField.Type = esriFieldType.esriFieldTypeGeometry;
shapeField.GeometryDef = geomDef;
Field store_idField = new Field();
store_idField.Name = "STORE_ID";
store_idField.Type = esriFieldType.esriFieldTypeString;
Fields fields = new Fields();
fields.FieldArray = new Field[] { oidField, shapeField, store_idField };

PointN point1 = new PointN();
point1.SpatialReference = gcs;
point1.X = -117.194152;
point1.Y = 34.057165;
Record record1 = new Record();
record1.Values = new object[] { 1, point1, "1" };

RecordSet rs = new RecordSet();
rs.Fields = fields;
rs.Records = new Record[] { record1 };

// Create a PointLayer based on the point Feature RecordSet (FeatureSet)
PointLayer pointLayer = new PointLayer();
pointLayer.RecordSet = rs;
pointLayer.SpatialReference = gcs;

// Specify analysis options
TaskOutputType[] outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };

// Specify parameters of DriveTime task
DriveTimeParameters parameters = new DriveTimeParameters();
parameters.DistanceUnits = esriBADriveTimeUnits.esriDriveTimeUnitsMinutes;
parameters.Radii = new double[] { 1, 3, 5 };
parameters.StoreIDField = "STORE_ID";
parameters.Stores = pointLayer;
// Associate the token with the request
parameters.token = token;

// Instantiate the BAOReport proxy object to submit the
// request
BAOReport baoReportProxy = new BAOReport();

// Submit the task
TaskResultOutput result = baoReportProxy.DriveTime(parameters, null, outputOptions);

// The result.RecordSet property will contain the geometry of the 3 rings which
// can be optionally used in further analysis

Example (2) Code
VB.NET
' Authentication: Uses Authentication proxy class to generate token.

' Business Analyst Online API Sample credentials.
' NOTE: These credentials are associated with an 
' account which constrains analysis to the
' two ZIP codes in Redlands, CA.
Dim username As String = "BAOAPISAMPLE"
' Substitute user name here
Dim password As String = "baoapisample"
' Substitute password here
Dim auth As New Authentication()
Dim token As String = auth.getToken(username, password)

Dim gcs As SpatialReference = New GeographicCoordinateSystem()
gcs.WKID = 4326
gcs.WKIDSpecified = True

' Define a geometry definition of the FeatureSet (Feature RecordSet)
Dim geomDef As New GeometryDef()
geomDef.GeometryType = esriGeometryType.esriGeometryPoint
geomDef.SpatialReference = gcs

' Define the attribute fields of the FeatureSet
Dim oidField As New Field()
oidField.Name = "OID"
oidField.AliasName = "Object ID"
oidField.Type = esriFieldType.esriFieldTypeOID
Dim shapeField As New Field()
shapeField.Name = "Shape"
shapeField.AliasName = "Geometry"
shapeField.Type = esriFieldType.esriFieldTypeGeometry
shapeField.GeometryDef = geomDef
Dim store_idField As New Field()
store_idField.Name = "STORE_ID"
store_idField.Type = esriFieldType.esriFieldTypeString
Dim fields As New Fields()
fields.FieldArray = New Field() {oidField, shapeField, store_idField}

Dim point1 As New PointN()
point1.SpatialReference = gcs
point1.X = -117.194152
point1.Y = 34.057165
Dim record1 As New Record()
record1.Values = New Object() {1, point1, "1"}

Dim rs As New RecordSet()
rs.Fields = fields
rs.Records = New Record() {record1}

' Create a PointLayer based on the point Feature RecordSet (FeatureSet)
Dim pointLayer As New PointLayer()
pointLayer.RecordSet = rs
pointLayer.SpatialReference = gcs

' Specify analysis options
Dim outputOptions As TaskOutputType() = New TaskOutputType() {TaskOutputType.GetFeatureClass}

' Specify parameters of DriveTime task
Dim parameters As New DriveTimeParameters()
parameters.DistanceUnits = esriBADriveTimeUnits.esriDriveTimeUnitsMinutes
parameters.Radii = New Double() {1, 3, 5}
parameters.StoreIDField = "STORE_ID"
parameters.Stores = pointLayer
' Associate the token with the request
parameters.token = token

' Instantiate the BAOReport proxy object to submit the
' request
Dim baoReportProxy As New BAOReport()

' Submit the task
Dim result As TaskResultOutput = baoReportProxy.DriveTime(parameters, Nothing, outputOptions)

' The result.RecordSet property will contain the geometry of the 3 rings which
' can be optionally used in further analysis

 

Example 3: Create 2-minute Drive Time trade/service area rings around two different store/origin points described by a PointLayer as ArrayOfPointRecords and return the serialized feature class geometry along with two Summary Reports.

Notes: Example 3 demonstrates code which consumes the BAOReport proxy class (generated from the WSDL ) without leveraging the BAOReportHelper class. Please view Example 1 above for additional information about the BAOReportHelper class.

Download complete source code as Visual Studio solution to immediately execute samples. (See DriveTimeExamples.driveTimeExample3 in source.)

Output Report Created with Example

Click to download actual output file

Click to download actual output file

Example (3) Code
C#
// Authentication: Uses Authentication proxy class to generate token.

// Business Analyst Online API Sample credentials.
// NOTE: These credentials are associated with an 
// account which constrains analysis to the
// two ZIP codes in Redlands, CA.
string username = "BAOAPISAMPLE"; // Substitute user name here
string password = "baoapisample"; // Substitute password here

Authentication auth = new Authentication();
string token = auth.getToken(username, password);

SpatialReference gcs = new GeographicCoordinateSystem();
gcs.WKID = 4326;
gcs.WKIDSpecified = true;

// Create store points
PointRecord[] points = new PointRecord[2];

points[0] = new PointRecord();
points[0].Name = "store1";
points[0].Description = "potential loc 1";
points[0].StoreID = "1";
points[0].Latitude = 34.042737;
points[0].Longitude = -117.183838;

points[1] = new PointRecord();
points[1].Name = "store2";
points[1].Description = "potential loc 2";
points[1].StoreID = "2";
points[1].Latitude = 34.063541;
points[1].Longitude = -117.182004;

// Create a store feature layer based on an array of point records
PointLayer storeLayer = new PointLayer();
storeLayer.Points = points;

// Create a PointLayer based on the point Feature RecordSet (FeatureSet)
PointLayer pointLayer = new PointLayer();
pointLayer.Points = points;
pointLayer.SpatialReference = gcs;

// Specify analysis options
TaskOutputType[] outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass, TaskOutputType.GetReport };

// Specify report options
ReportOptions ro1 = new ReportOptions();
ro1.ReportFormat = "PDF";
ro1.TemplateName = "dandi";
ro1.ReportHeader = new KeyValue[3];
ro1.ReportHeader[0] = new KeyValue();
ro1.ReportHeader[0].Key = "address";
ro1.ReportHeader[0].Value = "[address field]";
ro1.ReportHeader[1] = new KeyValue();
ro1.ReportHeader[1].Key = "locationname";
ro1.ReportHeader[1].Value = "[locationname field]";
ro1.ReportHeader[2] = new KeyValue();
ro1.ReportHeader[2].Key = "subtitle";
ro1.ReportHeader[2].Value = "[subtitle field]";


ReportOptions ro2 = new ReportOptions();
ro2.ReportFormat = "S.XML";
ro2.TemplateName = "dandi";

// Specify parameters of DriveTime task
DriveTimeParameters parameters = new DriveTimeParameters();
parameters.DistanceUnits = esriBADriveTimeUnits.esriDriveTimeUnitsMinutes;
parameters.Radii = new double[] { 2.0 };
parameters.StoreIDField = "STORE_ID";
parameters.Stores = pointLayer;
parameters.ReportOptions = new ReportOptions[] { ro1, ro2 };
// Associate the token with the request
parameters.token = token;

// Instantiate the BAOReport proxy object to submit the
// request
BAOReport baoReportProxy = new BAOReport();

// Submit the task
TaskResultOutput result = baoReportProxy.DriveTime(parameters, null, outputOptions);

// The result.RecordSet property will contain the geometry of the 3 rings which
// can be optionally used in further analysis

Example (3) Code
VB.NET
' Authentication: Uses Authentication proxy class to generate token.

' Business Analyst Online API Sample credentials.
' NOTE: These credentials are associated with an 
' account which constrains analysis to the
' two ZIP codes in Redlands, CA.
Dim username As String = "BAOAPISAMPLE"
' Substitute user name here
Dim password As String = "baoapisample"
' Substitute password here
Dim auth As New Authentication()
Dim token As String = auth.getToken(username, password)

Dim gcs As SpatialReference = New GeographicCoordinateSystem()
gcs.WKID = 4326
gcs.WKIDSpecified = True

' Create store points
Dim points As PointRecord() = New PointRecord(1) {}

points(0) = New PointRecord()
points(0).Name = "store1"
points(0).Description = "potential loc 1"
points(0).StoreID = "1"
points(0).Latitude = 34.042737
points(0).Longitude = -117.183838

points(1) = New PointRecord()
points(1).Name = "store2"
points(1).Description = "potential loc 2"
points(1).StoreID = "2"
points(1).Latitude = 34.063541
points(1).Longitude = -117.182004

' Create a store feature layer based on an array of point records
Dim storeLayer As New PointLayer()
storeLayer.Points = points

' Create a PointLayer based on the point Feature RecordSet (FeatureSet)
Dim pointLayer As New PointLayer()
pointLayer.Points = points
pointLayer.SpatialReference = gcs

' Specify analysis options
Dim outputOptions As TaskOutputType() = New TaskOutputType() {TaskOutputType.GetFeatureClass, TaskOutputType.GetReport}

' Specify report options
Dim ro1 As New ReportOptions()
ro1.ReportFormat = "PDF"
ro1.TemplateName = "dandi"
ro1.ReportHeader = New KeyValue(2) {}
ro1.ReportHeader(0) = New KeyValue()
ro1.ReportHeader(0).Key = "address"
ro1.ReportHeader(0).Value = "[address field]"
ro1.ReportHeader(1) = New KeyValue()
ro1.ReportHeader(1).Key = "locationname"
ro1.ReportHeader(1).Value = "[locationname field]"
ro1.ReportHeader(2) = New KeyValue()
ro1.ReportHeader(2).Key = "subtitle"
ro1.ReportHeader(2).Value = "[subtitle field]"


Dim ro2 As New ReportOptions()
ro2.ReportFormat = "S.XML"
ro2.TemplateName = "dandi"

' Specify parameters of DriveTime task
Dim parameters As New DriveTimeParameters()
parameters.DistanceUnits = esriBADriveTimeUnits.esriDriveTimeUnitsMinutes
parameters.Radii = New Double() {2.0}
parameters.StoreIDField = "STORE_ID"
parameters.Stores = pointLayer
parameters.ReportOptions = New ReportOptions() {ro1, ro2}
' Associate the token with the request
parameters.token = token

' Instantiate the BAOReport proxy object to submit the
' request
Dim baoReportProxy As New BAOReport()

' Submit the task
Dim result As TaskResultOutput = baoReportProxy.DriveTime(parameters, Nothing, outputOptions)

' The result.RecordSet property will contain the geometry of the 3 rings which
' can be optionally used in further analysis

 

Example 4: Create 0.6, 1.2, 1.8-mile Drive distance-based trade/service area rings around a single store/origin points described by a PointLayer as FeatureSet in the Web Mercator projected Spatial Reference system and return the serialized feature class geometry along with a report from the Census 2010 dataset describing/summarizing several data points for the area.

Notes: Example 4 demonstrates code which consumes the BAOReport proxy class (generated from the WSDL ) without leveraging the BAOReportHelper class. Please view Example 1 above for additional information about the BAOReportHelper class.

Download complete source code as Visual Studio solution to immediately execute samples. (See DriveTimeExamples.driveTimeExample4 in source.)

Output Report Created with Example

Click to download actual output file

Example (4) Code
C#
// Authentication: Uses Authentication proxy class to generate token.

// Business Analyst Online API Sample credentials.
// NOTE: These credentials are associated with an 
// account which constrains analysis to the
// two ZIP codes in Redlands, CA.
string username = "BAOAPISAMPLE"; // Substitute user name here
string password = "baoapisample"; // Substitute password here

Authentication auth = new Authentication();
string token = auth.getToken(username, password);

SpatialReference pcs = new ProjectedCoordinateSystem();
pcs.WKID = 102100;
pcs.WKIDSpecified = true;

// Define a geometry definition of the FeatureSet (Feature RecordSet)
GeometryDef geomDef = new GeometryDef();
geomDef.GeometryType = esriGeometryType.esriGeometryPoint;
geomDef.SpatialReference = pcs;

// Define the attribute fields of the FeatureSet
Field oidField = new Field();
oidField.Name = "OID";
oidField.AliasName = "Object ID";
oidField.Type = esriFieldType.esriFieldTypeOID;
Field shapeField = new Field();
shapeField.Name = "Shape";
shapeField.AliasName = "Geometry";
shapeField.Type = esriFieldType.esriFieldTypeGeometry;
shapeField.GeometryDef = geomDef;
Field store_idField = new Field();
store_idField.Name = "STORE_ID";
store_idField.Type = esriFieldType.esriFieldTypeString;
Fields fields = new Fields();
fields.FieldArray = new Field[] { oidField, shapeField, store_idField };

PointN point1 = new PointN();
point1.SpatialReference = pcs;
point1.X = -13044845.175361;
point1.Y = 4034542.005670;
Record record1 = new Record();
record1.Values = new object[] { 1, point1, "1" };

RecordSet rs = new RecordSet();
rs.Fields = fields;
rs.Records = new Record[] { record1 };

// Create a PointLayer based on the point Feature RecordSet (FeatureSet)
PointLayer pointLayer = new PointLayer();
pointLayer.RecordSet = rs;
pointLayer.SpatialReference = pcs;

// Specify analysis options
TaskOutputType[] outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass, TaskOutputType.GetReport };

// Specify report options (See the Get Report Templates method to view
// the list of report templates available with your Online API subscription.
ReportOptions ro1 = new ReportOptions();
ro1.ReportFormat = "PDF";
ro1.TemplateName = "census2010_profile";

// Specify parameters of DriveTime task
DriveTimeParameters parameters = new DriveTimeParameters();
parameters.DistanceUnits = esriBADriveTimeUnits.esriMiles;
parameters.Radii = new double[] { 0.6, 1.2, 1.8 };
parameters.StoreIDField = "STORE_ID";
parameters.Stores = pointLayer;
parameters.ReportOptions = new ReportOptions[] { ro1 };

// Specify the dataset (This is an optional parameter with a default value of "USA"
// which is the deafault Esri dataset.  See the Get Datasets method to view the 
// available datasets with your Online API subscription.)
parameters.ActiveDatasetID = "USACensus2010";

// If the FeatureSet geometry was requested in the output and the output is requested
// in a coordinate system other than WKID:4326 (WGS 1984 Geographic Coordinate System), 
// which is the default Esri dataset, specify it here.
parameters.OutputSpatialReference = pcs;

// Associate the token with the request
parameters.token = token;


// Instantiate the BAOReport proxy object to submit the
// request
BAOReport baoReportProxy = new BAOReport();

// Submit the task
TaskResultOutput result = baoReportProxy.DriveTime(parameters, null, outputOptions);

// The result.RecordSet property will contain the geometry of the 3 rings which
// can be optionally used in further analysis. The result.Reports property contain 
// the generated report.

Example (4) Code
VB.NET
' Authentication: Uses Authentication proxy class to generate token.

' Business Analyst Online API Sample credentials.
' NOTE: These credentials are associated with an 
' account which constrains analysis to the
' two ZIP codes in Redlands, CA.
Dim username As String = "BAOAPISAMPLE"
' Substitute user name here
Dim password As String = "baoapisample"
' Substitute password here
Dim auth As New Authentication()
Dim token As String = auth.getToken(username, password)

Dim pcs As SpatialReference = New ProjectedCoordinateSystem()
pcs.WKID = 102100
pcs.WKIDSpecified = True

' Define a geometry definition of the FeatureSet (Feature RecordSet)
Dim geomDef As New GeometryDef()
geomDef.GeometryType = esriGeometryType.esriGeometryPoint
geomDef.SpatialReference = pcs

' Define the attribute fields of the FeatureSet
Dim oidField As New Field()
oidField.Name = "OID"
oidField.AliasName = "Object ID"
oidField.Type = esriFieldType.esriFieldTypeOID
Dim shapeField As New Field()
shapeField.Name = "Shape"
shapeField.AliasName = "Geometry"
shapeField.Type = esriFieldType.esriFieldTypeGeometry
shapeField.GeometryDef = geomDef
Dim store_idField As New Field()
store_idField.Name = "STORE_ID"
store_idField.Type = esriFieldType.esriFieldTypeString
Dim fields As New Fields()
fields.FieldArray = New Field() {oidField, shapeField, store_idField}

Dim point1 As New PointN()
point1.SpatialReference = pcs
point1.X = -13044845.175361
point1.Y = 4034542.00567
Dim record1 As New Record()
record1.Values = New Object() {1, point1, "1"}

Dim rs As New RecordSet()
rs.Fields = fields
rs.Records = New Record() {record1}

' Create a PointLayer based on the point Feature RecordSet (FeatureSet)
Dim pointLayer As New PointLayer()
pointLayer.RecordSet = rs
pointLayer.SpatialReference = pcs

' Specify analysis options
Dim outputOptions As TaskOutputType() = New TaskOutputType() {TaskOutputType.GetFeatureClass, TaskOutputType.GetReport}

' Specify report options (See the Get Report Templates method to view
' the list of report templates available with your Online API subscription.
Dim ro1 As New ReportOptions()
ro1.ReportFormat = "PDF"
ro1.TemplateName = "census2010_profile"

' Specify parameters of DriveTime task
Dim parameters As New DriveTimeParameters()
parameters.DistanceUnits = esriBADriveTimeUnits.esriDriveTimeUnitsMinutes
parameters.Radii = New Double() {0.6, 1.2, 1.8}
parameters.StoreIDField = "STORE_ID"
parameters.Stores = pointLayer
parameters.ReportOptions = New ReportOptions() {ro1}

' Specify the dataset (This is an optional parameter with a default value of "USA"
' which is the deafault Esri dataset.  See the Get Datasets method to view the 
' available datasets with your Online API subscription.)
parameters.ActiveDatasetID = "USACensus2010"

' If the FeatureSet geometry was requested in the output and the output is requested
' in a coordinate system other than WKID:4326 (WGS 1984 Geographic Coordinate System), 
' which is the default Esri dataset, specify it here.
parameters.OutputSpatialReference = pcs
' Associate the token with the request
parameters.token = token

' Instantiate the BAOReport proxy object to submit the
' request
Dim baoReportProxy As New BAOReport()

' Submit the task
Dim result As TaskResultOutput = baoReportProxy.DriveTime(parameters, Nothing, outputOptions)

' The result.RecordSet property will contain the geometry of the 3 rings which
' can be optionally used in further analysis. The result.Reports property contain 
' the generated report.

See Also