Share via


DrivingCostUnits property

Returns or sets the method used to determine route costs. Read/write GeoDrivingCostUnits.

GeoDrivingCostUnits

Value

Description

geoCostBasedOnDistance

0

Cost based on fixed rate per GeoUnit (mile or kilometer)

geoCostBasedOnLiters

1

Cost based on price per liter of fuel

geoCostBasedOnUKGallons

3

Cost based on price per U.K. gallon of fuel

geoCostBasedOnUSGallons

2

Cost based on price per U.S. gallon of fuel

Applies to

Objects: DriverProfile

Syntax

object.DrivingCostUnits

Parameters

Part

Description

object

Required. An expression that returns a DriverProfile object.

Remarks

Example

  Sub ChangeDrivingCostUnits()

  Dim objApp As New MapPoint.Application
  Dim objMap As MapPoint.Map
  Dim objRoute As MapPoint.Route

  'Set up the application
  Set objMap = objApp.ActiveMap
  Set objRoute = objMap.ActiveRoute
  objApp.Visible = True
  objApp.UserControl = True

  'Add route stops and calculate the route
  objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
  objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)

  'Set the DrivingCostUnits to fixed cost based on price per liter of fuel
  objRoute.DriverProfile.DrivingCostUnits = geoCostBasedOnLiters
  objRoute.Calculate

  'Get new route cost
  MsgBox "New route cost: $" + CStr(objRoute.Cost)

  End Sub

Note   This sample code is specific for use in MapPoint North America; it is for illustration purposes only.