HELP !! Mapping a route between 2 points

pbaughman
12-01-2006, 05:52 AM
i hope somebody can help as im tearing my hair out.....

ive got the following code ( which i copied out of msdn MapSpecification.Pushpins Property example ) :

'Route between two locations
Dim latLongs(1) As net.mappoint.renderv3.LatLong
latLongs(0) = New net.mappoint.renderv3.LatLong()
latLongs(1) = New net.mappoint.renderv3.LatLong()
latLongs(0).Latitude = 40
latLongs(0).Longitude = -120
latLongs(1).Latitude = 41
latLongs(1).Longitude = -121
Dim myRoute As net.mappoint.renderv3.Route
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", net.mappoint.routev3.SegmentPreference.Quickest)
'Get a map of the route and add pushpins to the start and end
Dim myRouteViews(0) As net.mappoint.renderv3.ViewByHeightWidth
myRouteViews(0) = myRoute.Itinerary.View.ByHeightWidth
Dim myPushpins(1) As net.mappoint.renderv3.Pushpin
myPushpins(0) = New net.mappoint.renderv3.Pushpin()
myPushpins(0).IconDataSource = "MapPoint.Icons"
myPushpins(0).IconName = "31"
myPushpins(0).Label = "Start"
myPushpins(0).LatLong = latLongs(0)
myPushpins(1) = New net.mappoint.renderv3.Pushpin()
myPushpins(1).IconDataSource = "MapPoint.Icons"
myPushpins(1).IconName = "29"
myPushpins(1).Label = "End"
myPushpins(1).LatLong = latLongs(1)

mapSpec.DataSourceName = "MapPoint.NA"
mapSpec.Route = myRoute
mapSpec.Pushpins = myPushpins
mapSpec.Views = myRouteViews
Dim myMaps() As net.mappoint.renderv3.MapImage
myMaps = renderService.GetMap(mapSpec)

*******************************************

my main problem is with the following line :

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

it doesnt seem to like the "latlongs" argument. it says its supposed to be a ROUTE instead of being a RENDER variable. however, ive already tried this and if i change it. then the latlong entry in the myPushPin says it doesnt like it as its now a ROUTE variable and not a RENDER....

PLEASE PLEASE PLEASE, CAN ANYBODY HELP ? im very new to mappoint web services....

shaistasohail
12-05-2006, 01:43 AM
Have you initialized the RouteService class?

shaistasohail
12-05-2006, 01:45 AM
Ooops! Hit submit too soon!

Have you initialized the route service class? Also can you post the error message that your are getting.

pbaughman
12-06-2006, 03:02 AM
thanks for your reply to my problem. it looks like that the problem was that i had not connected to the web service properly. thanks anyway, its much appreciated !

 
Web mp2kmag.com
mapforums.com