Question

I'm using gmap.net library to implement map in my winforms application Using Following code i can draw routes in my map

Dim lstR As New List(Of PointLatLng)

And

Dim routes As New GMapOverlay("routes")
SpcMap.Overlays.Add(routes)
Dim r As New GMapRoute(lstR, "My car route")
routes.Routes.Add(r)

But The Problem is That it's Not Drawing route correctly it Just draws connecting lines between points in list I tried many code but can't figure out what i need

Était-ce utile?

La solution

Try This One here you want to get route between Two perticulae points

Dim start As New PointLatLng(lstR(0).Lat, lstR(0).Lng)
    Dim ends As New PointLatLng(lstR(4).Lat, lstR(4).Lng)
    Dim route As MapRoute = GMapProviders.GoogleMap.GetRoute(start, ends, False, False, 13)
    Dim rs As New GMapRoute(route.Points, "Route1")
    Dim iOvrL As New GMapOverlay
    iOvrL.Routes.Add(rs)
    SpcMap.Overlays.Add(iOvrL)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top