Share via


Direction.Towards Property

Direction.Towards Property

The toward or signpost text for the specified direction. String.


Public Dim Towards As String
    Member of [Namespace].Direction

[C#]

public System.String Towards
    Member of [Namespace].Direction

Remarks

  • Not every direction has a Towards property. Toward information is most commonly found in routes using limited-access highway interchanges; that is, interstate or motorway interchanges.

  • The following line is an example of a Towards property:

    WA-520 / Bellevue / Kirkland

  • When combining the Towards property with the Instruction property, you may want to precede the Towards property string with the word "toward" to make the combined line more clear. For example:

    Instruction property: At I-5 Exit 168B, take ramp (RIGHT) onto SR-520

    Towards property: WA-520 / Bellevue / Kirkland

    Combined: At I-5 Exit 168B, take ramp (RIGHT) onto SR-520 toward WA-520 / Bellevue / Kirkland

Example

[Visual Basic]

'Calculate a route and print instructions
'and the towards instruction if one exists
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
 If myRoute.Itinerary.Segments(0).Directions(i).Towards  "" Then
  Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).Instruction _
   + " towards " + myRoute.Itinerary.Segments(0).Directions(i).Towards)
 Else
  Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).Instruction)
 End If
Next i



[C#]

//Calculate a route and print instructions 
//and the towards instruction if one exists
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++)
{
 if (myRoute.Itinerary.Segments[0].Directions[i].Towards != "") 
 {
  Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].Instruction 
   + " towards " + myRoute.Itinerary.Segments[0].Directions[i].Towards );
 }
 else
 {
  Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].Instruction);
 }
}


See Also

  Direction Class   |   Direction.Instruction Property