Share via


MapSpecification.Route Property

MapSpecification.Route Property

The route (Route object) to render on the map.


Public Route As Route



[C#]

public Route Route;

Remarks

  • If the Route property is passed and the Views property is null, the map view of the entire route is used. If both the Route and Views properties are null, a SOAP fault is returned.

Example

[Visual Basic]

'Route between two locations
Dim latLongs(1) As LatLong
latLongs(0) = New LatLong()
latLongs(1) = New LatLong()
latLongs(0).Latitude = 40
latLongs(0).Longitude = -120
latLongs(1).Latitude = 41
latLongs(1).Longitude = -121

Dim myRoute As Route
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest)

'Get a map of the route
Dim myRouteViews(0) As ViewByHeightWidth
myRouteViews(0) = myRoute.Itinerary.View.ByHeightWidth

Dim mapSpec As New MapSpecification()
mapSpec.DataSourceName = "MapPoint.NA"
mapSpec.Route = myRoute
mapSpec.Views = myRouteViews

Dim myMaps() As MapImage
myMaps = renderService.GetMap(mapSpec)



[C#]

//Route between two locations
LatLong[] latLongs = new LatLong[2];
latLongs[0] = new LatLong();
latLongs[1] = new LatLong();
latLongs[0].Latitude = 40;
latLongs[0].Longitude = -120;
latLongs[1].Latitude = 41;
latLongs[1].Longitude = -121;

Route myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest);

//Get a map of the route
ViewByHeightWidth[] myRouteViews = new ViewByHeightWidth[1];
myRouteViews[0] = myRoute.Itinerary.View.ByHeightWidth;

MapSpecification mapSpec  = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Route = myRoute;
mapSpec.Views = myRouteViews;

MapImage[] myMaps = renderService.GetMap(mapSpec);


See Also

  MapSpecification Class   |   Route Class   |   RenderServiceSoap.GetMap Method