How to show a route on the map?

Topics: Windows Forms
Nov 16, 2012 at 3:11 PM

Hi there,

I'm new here and I want to build a simple map where I can select 2 Points and create a route from one to the other.

It seems that my code produced a route, but I can not see anything on the map. What am I doing wrong?

This is my code:

Private Sub btnRoute_Click(sender As Object, e As EventArgs) Handles btnRoute.Click
    If routePositions.Count > 0 Then
      Dim route As MapRoute = GMapProviders.GoogleMap.GetRoute(routePositions(0), routePositions(routePositions.Count - 1), False, False, CInt(MainMap.Zoom))
      Dim r As New GMapRoute(route.Points, "My Route")
      r.Stroke = Pens.AliceBlue      
    End If
  End Sub




Nov 16, 2012 at 4:23 PM

i guess you forget to add routes to map.Overlays

Nov 19, 2012 at 12:01 PM

You're right. Thank you very much. Now it works.

Dec 12, 2012 at 5:26 AM

well , is the method GMapProviders.GoogleMap.GetRoute can work without the internet? Or How to cache all the zoom scale map from the server?

Dec 12, 2012 at 9:17 AM

if you call GetRoute it's cached, therefore you can use it offline, but thats only one address, and you can't cache all