Share via


Segment.Waypoint Property

Segment.Waypoint Property

The waypoint (Waypoint object) for the route segment; that is, the beginning of the segment.


Public Waypoint As Waypoint


[C#]

public Waypoint Waypoint;

Remarks

  • For the last segment of a route, the Waypoint property is the last stop in the route: the end waypoint.

Example

[Visual Basic]

'Calculate a route and print the latitude and longitude coordinates
'of the start and end points and the 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)

Console.WriteLine("Start Point: " + myRoute.Itinerary.Segments(0).Waypoint.Location.LatLong.Latitude.ToString() _
 + ", " + myRoute.Itinerary.Segments(0).Waypoint.Location.LatLong.Longitude.ToString())

Dim i As Integer
For i = 0 To myRoute.Itinerary.Segments(0).Directions.Length - 1
 Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).Instruction)
Next i

Console.WriteLine("End Point: " + myRoute.Itinerary.Segments(1).Waypoint.Location.LatLong.Latitude.ToString() _
 + ", " + myRoute.Itinerary.Segments(1).Waypoint.Location.LatLong.Longitude.ToString())



[C#]

//Calculate a route and print the latitude and longitude coordinates
//of the start and end points and the 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);

Console.WriteLine("Start Point: " + myRoute.Itinerary.Segments[0].Waypoint.Location.LatLong.Latitude.ToString() 
 + ", " + myRoute.Itinerary.Segments[0].Waypoint.Location.LatLong.Longitude.ToString());

for(int i = 0; i < myRoute.Itinerary.Segments[0].Directions.Length ; i++)
{
 Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].Instruction);
}

Console.WriteLine("End Point: " + myRoute.Itinerary.Segments[1].Waypoint.Location.LatLong.Latitude.ToString() 
 + ", " + myRoute.Itinerary.Segments[1].Waypoint.Location.LatLong.Longitude.ToString());


See Also

  Segment Class   |   Waypoint Class