multiple routes on one map

Topics: Help
Nov 18, 2011 at 10:30 PM

hi!

i have two vehicles. they are sending their positions to a database.

i want to draw the route on the map to a certain point from the current position of each vehicle

until now i have only managed one route drawing

i can see that routes has two routes in it, but i dont know how to get them on the screen

here's the code for the map

 

For z = 0 To deviceid.Length - 1
            x = GMapProviders.OpenStreetMap.GetRouteBetweenPoints(New PointLatLng((lat), (lng)), (New PointLatLng(CDbl(latitude(z)), CDbl(longitude(z)))), False, False, 5)
            item = New GMapRoute(x.Points, "test")


            If Not x Is Nothing Then
                routes.Routes.Add(item)
                GMapControl1.ZoomAndCenterRoute(item)
                GMapControl1.Overlays.Add(routes)
            End If

        Next

 

could someone point me to the right direction please?

 

thank you

Nov 18, 2011 at 11:16 PM

got it - almost

just realized why it's called object oriented programming ;)

For z = 0 To deviceid.Length - 1
            x = GMapProviders.OpenStreetMap.GetRouteBetweenPoints(New PointLatLng((lat), (lng)), (New PointLatLng(CDbl(latitude(z)), CDbl(longitude(z)))), False, False, 5)
            routes = New GMapOverlay(GMapControl1, "routes" & deviceid(z))
            item = New GMapRoute(x.Points, "test" & deviceid(z))


            If Not x Is Nothing Then
                routes.Routes.Add(item)
                'GMapControl1.ZoomAndCenterRoute(item)
                GMapControl1.Overlays.Add(routes)

            End If

        Next

 

now i only need to "auto" zoom

 

regards