Direction.ID Property
Direction.ID Property
The index of the specified direction into the array of directions contained in a route. One-based. Integer.
Public Dim ID As Integer
Member of [Namespace].Direction
[C#]
public System.Int32 ID
Member of [Namespace].Direction
Remarks
- A route itinerary is comprised of an array of segments (RouteItinerary.Segments property), which are the portions of a route from one waypoint to the next. Each route segment contains an array of directions (Segment.Directions property). The ID property for a direction indicates its order within the entire route itinerary.
Example
[Visual Basic]
'Calculate a route and print out instructions
Dim latLongs(1) As LatLong
latLongs(0) = New LatLong()
latLongs(0).Latitude = 40
latLongs(0).Longitude = -120
latLongs(1) = New LatLong()
latLongs(1).Latitude = 41
latLongs(1).Longitude = -121
Dim myRoute As Route
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest)
Dim i As Integer
For i = 0 To myRoute.Itinerary.Segments(0).Directions.Length - 1
Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).ID.ToString() _
+ " " + myRoute.Itinerary.Segments(0).Directions(i).Instruction)
Next i
[C#]
//Calculate a route and print out instructions
LatLong[] latLongs = new LatLong[2];
latLongs[0] = new LatLong();
latLongs[0].Latitude = 40;
latLongs[0].Longitude = -120;
latLongs[1] = new LatLong();
latLongs[1].Latitude = 41;
latLongs[1].Longitude = -121;
Route myRoute;
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest);
for(int i = 0; i < myRoute.Itinerary.Segments[0].Directions.Length ; i++)
{
Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].ID.ToString()
+ " " + myRoute.Itinerary.Segments[0].Directions[i].Instruction);
}
See Also
Direction Class | RouteItinerary.Segments Property | Segment.Directions Property