Direction.LatLong Property
Direction.LatLong Property
The latitude and longitude coordinates (LatLong object) of the starting point of the specified direction.
Public Dim LatLong As [Namespace].LatLong
Member of [Namespace].Direction
[C#]
public [Namespace].LatLong LatLong
Member of [Namespace].Direction
Remarks
- The LatLong property is the point at which the action (Action property) occurs. For example, if the Instruction property is "Turn RIGHT (East) onto W 6th Ave", the LatLong property is the point at which the right turn is made.
Example
[Visual Basic]
'Calculate a route and print instructions
'with the corresponding latitude/longitude values
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("At coordinate (" + myRoute.Itinerary.Segments(0).Directions(i).LatLong.Latitude.ToString() _
+ ", " + myRoute.Itinerary.Segments(0).Directions(i).LatLong.Longitude.ToString() _
+ "), " + myRoute.Itinerary.Segments(0).Directions(i).Instruction)
Next i
[C#]
//Calculate a route and print instructions
//with corresponding latitude/longitude values
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("At coordinate (" + myRoute.Itinerary.Segments[0].Directions[i].LatLong.Latitude.ToString()
+ ", " + myRoute.Itinerary.Segments[0].Directions[i].LatLong.Longitude.ToString()
+ "), " + myRoute.Itinerary.Segments[0].Directions[i].Instruction);
}
See Also
Direction Class | LatLong Class | Direction.Action Property | Direction.Instruction Property