Showing route VB.NET GetRouteBetweenPoints

Topics: General
Oct 1, 2010 at 11:53 AM
Edited Oct 1, 2010 at 11:54 AM


How do I show the route I created on the map? The code I have so far...

Dim myStart As String = "Sexbierum, Nederland"
Dim myEnd As String = "Leeuwarden, Nederland"

GMaps.Instance.GetRouteBetweenPoints(myStart, myEnd, False, map_zoom.Value)

How Do I show the route between the 2 places using the Overlay?

Thanks for the help in advance.

Oct 1, 2010 at 12:09 PM
var routes = new GMapOverlay(MainMap, "routes");

// ...
      // add test route
      private void button3_Click(object sender, EventArgs e)
         MapRoute route = GMaps.Instance.GetRouteBetweenPoints(start, end, false, (int) MainMap.Zoom);
         if(route != null)
            // add route
            GMapRoute r = new GMapRoute(route.Points, route.Name);

            // add route start/end marks
            GMapMarker m1 = new GMapMarkerGoogleRed(start);
            m1.ToolTipText = "Start: " + route.Name;
            m1.ToolTipMode = MarkerTooltipMode.Always;

            GMapMarker m2 = new GMapMarkerGoogleGreen(end);
            m2.ToolTipText = "End: " + end.ToString();
            m2.ToolTipMode = MarkerTooltipMode.Always;


Oct 1, 2010 at 1:53 PM

I was a bit confused about the "GMapRoute r =", Didn't how to convert it to VB.NET, but after a few tries I got it. Works like a charm.

Mucho thanks.

Oct 1, 2010 at 3:13 PM
Edited Oct 1, 2010 at 3:13 PM

Hmmm... small issue left regarding the markers, cause my "start" and "end" are Strings. Anyone with a workaround, know how to solve this?

Dim myStart As String = map_txt_route_start.Text
Dim myEnd As String = map_txt_route_end.Text

Dim route As MapRoute = GMaps.Instance.GetRouteBetweenPoints(myStart, myEnd, False, map_zoom.Value)


Oct 1, 2010 at 3:17 PM

so where is the problem?

Oct 1, 2010 at 4:04 PM

The problem is that it doesn't accept my "start" and "end".

Dim markerStart As GMapMarker = New GMapMarkerGoogleGreen(myStart)  << String can't be converted to GMAP pointLatLng

Oct 1, 2010 at 4:13 PM

use route.First/Last

Oct 1, 2010 at 5:13 PM

hmmm... Call me stupid, but I don't get it.

Oct 1, 2010 at 6:36 PM


GetRouteBetweenPoints returns object which contains points, you need first point and the last, check the demos source...

Oct 12, 2010 at 9:17 AM
Edited Oct 12, 2010 at 9:53 AM

Hi radioman.

Firstly... GREAT work on this. Love your work!

I plan to use this for a route planning from a list of zip/postal codes.

I have read this discussion and it seems to be what I need. I would like to show a route containing more than one section using Postcodes to find the points.

Dim PostcodeArray(4)
Dim ovrl As New GMapOverlay(MainMap, "RoutesLayer")
PostcodeArray(0) = "DN19 7RT" 
PostcodeArray(1) = "DN34 4QN" 
PostcodeArray(2) = "DN37 0FB" 
PostcodeArray(3) = "HU15 2QD" 
PostcodeArray(4) = "DN19 7RT"
Where do I go from here?
Also, where is the Demo source?

All help appreciated.

Oct 12, 2010 at 10:13 AM

Oct 26, 2010 at 3:50 PM


I'm from Colombia. Excuse my bad writing.

When I try to instantiate the method: MapRoute route = GMaps.Instance.GetRouteBetweenPoints(start, end, false, (int)gMapMapa.Zoom); is null. then it enters the if. Help please

Oct 26, 2010 at 5:25 PM

tried some other points?

Nov 6, 2010 at 2:48 PM

No. What do you recommend?

Nov 6, 2010 at 3:07 PM

routing in that are doesn't work even in You can try ask them in google support forum