Top |
Post New Question |
Read All |
MP2K Asks Microsoft
533
Ricardo Ferrao
-
December 10, 2001
Ok, I've several questions.
1) If it's possible, how can I retrieve all points (lat/lon) that belong to the road network?
2) Again, if it's possible and from what I understood from my last question, how can I find a route between two points? What kind of struture will be the output? Does it contains what kind of roads are each segment?
3) Does anyone can share with me some similar code that does what I pretend?
Oh... And thanks for your feedback!
Answer:
Let me answer 2) first. The easiest way to get familiar with the object model for routes is to create a VB app with the MapPoint ActiveX control called "ctlMapPoint" and a Command button called "cmdTest", create a route on the map and step through the following code:
Private Sub cmdTest_Click()
On Error GoTo ErrSub
Dim objRoute As MapPointCtl.Route
Dim objWP As MapPointCtl.Waypoints
Dim objDir As MapPointCtl.Directions
Set objRoute = ctlMapPoint.ActiveMap.ActiveRoute
Set objWP = objRoute.Waypoints
Set objDir = objRoute.Directions
ExitSub:
Set objDir = Nothing
Set objWP = Nothing
Set objRoute = Nothing
Exit Sub
ErrSub:
Resume ExitSub
End Sub
Each step in the driving direction contained in objDir has a location object as a property. You can then get lat/lon using Gilles Kohl's code available here.
It doesn't appear to me as if the type of road for each segment is generated. MapPoint must have that information internally for the cost calculation, but it does not appear in the direction object.
- Walt Cygan
Post New Answer / Follow-up