radioman / greatmaps

GMap.NET - Great Maps for Windows Forms & Presentation
909 stars 409 forks source link

Unable to trace routes in map | GMap.net | VB.net #184

Open Tecoest opened 2 years ago

Tecoest commented 2 years ago

Hi, I'm facing a issue where i'm unable to trace routes using any map provider I've chosen, I must be doing something wrong......

Using Google maps I can set markers and create poligons but when I create a route I get status "Request Denied" already tried using API keys and using code to replace URL's from http to https but i still get request denied... Also when i try using a diferent route provider MP needs a few seconds to process but returns empty variable

This is the code I'm using

        GMapW.MapProvider = GoogleMapProvider.Instance
        GMapW.Position = New PointLatLng(40.654331, -73.917067)
        Dim RP As RoutingProvider = DirectCast(GMapW.MapProvider, RoutingProvider)
        Dim P1 As New PointLatLng(40.657161, -73.921079)
        Dim P2 As New PointLatLng(40.65587, -73.915188)
        Dim MP As MapRoute = RP.GetRoute(P1, P2, True, False, Convert.ToInt32(GMapW.Zoom))
        Dim R As New GMap.NET.WindowsForms.GMapRoute(MP.Points, "Route")
        Dim SB As New SolidBrush(Color.FromArgb(125, 0, 255, 0))
        R.Stroke = New Pen(SB, 6)
        Dim mOverlayRoutes = New GMapOverlay("Routes")
        mOverlayRoutes.Routes.Add(R)
        GMapW.Overlays.Add(mOverlayRoutes)

Any tips apreciated...