Direction.View Property
Direction.View Property
The map views (MapViewRepresentations object) for the specified direction. Includes a view defined by bounding rectangle and a view defined by center point, height, and width.
Public Dim View As [Namespace].MapViewRepresentations
Member of [Namespace].Direction
[C#]
public [Namespace].MapViewRepresentations View
Member of [Namespace].Direction
Remarks
The View property is returned only when the SegmentOptions.CalculateDirectionMapView property is set to True.
The View property does not contain a view defined by center point and scale.
Example
[Visual Basic]
'Calculate a route and use the directions views to
'get a map for each instruction (turn-by-turn maps)
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 myTurnByTurnViews(myRoute.Itinerary.Segments(0).Directions.Length - 1) As ViewByBoundingRectangle
Dim mapSpec As New MapSpecification()
mapSpec.DataSourceName = "MapPoint.NA"
mapSpec.Route = myRoute
Dim i As Integer
For i = 0 To myRoute.Itinerary.Segments(0).Directions.Length - 1
myTurnByTurnViews(i) = myRoute.Itinerary.Segments(0).Directions(i).View.ByBoundingRectangle
Next i
mapSpec.Views = myTurnByTurnViews
Dim myMaps() As MapImage
myMaps = renderService.GetMap(mapSpec)
[C#]
//Calculate a route and use the directions views to
//get a map for each instruction (turn-by-turn maps)
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);
ViewByBoundingRectangle[] myTurnByTurnViews = new ViewByBoundingRectangle[myRoute.Itinerary.Segments[0].Directions.Length];
MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Route = myRoute;
for(int i = 0; i < myRoute.Itinerary.Segments[0].Directions.Length ; i++)
{
myTurnByTurnViews[i] = myRoute.Itinerary.Segments[0].Directions[i].View.ByBoundingRectangle;
}
mapSpec.Views = myTurnByTurnViews;
MapImage[] myMaps = renderService.GetMap(mapSpec);
See Also
Direction Class | MapViewRepresentations Class | SegmentOptions.CalculateDirectionMapView Property