-1

I want to draw polyline on map. I can't find any example or documentation. Could somone help?

// Initialize map:
gMap.MapProvider = GMap.NET.MapProviders.OpenStreetMapProvider.Instance;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
gMap.Position = new PointLatLng(53.44827,14.49152);

//somepoints
//point1 = new PointLatLng(53.44827,14.49152);
//point2 = new PointLatLng(53.44827,14.49152);
//point3 = new PointLatLng(53.44827,14.49152);

//draw polyline
GarryMoveOut
  • 377
  • 5
  • 19
  • Have you actually done any searching for this? Within seconds of google searching I found [this tutorial](http://www.websofia.com/2013/02/gmap-net-tutorial-maps-markers-and-polygons/) and [this Q&A here at SO](http://stackoverflow.com/questions/9308673/how-to-draw-circle-on-the-map-using-gmap-net-in-c-sharp). Have you actually tried anything yet? – DuncanKinnear Jun 11 '15 at 22:43
  • I dont need markers or polygons but polylines – GarryMoveOut Jun 11 '15 at 22:52
  • Have you tried `GMapRoute`? – DuncanKinnear Jun 11 '15 at 23:03
  • It works like navigation. It draw only lines on streets. Maybee there is other way to draw polilines on map, other library. – GarryMoveOut Jun 11 '15 at 23:09

1 Answers1

0

1)Create two lat,long points i.e. startLat,startLong & endLat,endLong

2)then use following code

Dim polygonPoints1 As List(Of PointLatLng) = New List(Of PointLatLng)
polygonPoints1.Add(New PointLatLng(startLat, startLong ))
polygonPoints1.Add(New PointLatLng(endLat, endLong))

r = New GMap.NET.WindowsForms.GMapRoute(polygonPoints1, "MyRoute")

r.Stroke.DashStyle = Drawing2D.DashStyle.Dash
Dim routesOverlay As GMapOverlay = New GMapOverlay("routes")
routesOverlay.Routes.Add(r)
Me.myMap.Overlays.Add(routesOverlay)

Hope this resolves your issue.

Mandar
  • 94
  • 1
  • 7