

After all, it all boils down to latitude/longitude coordinates.Īpart from the start and end points, the GetRoutemethod takes some more arguments. You could use a different mapping provider ( BingMapProvider, for instance) to create the route, and use it with yet another provider for the actual map images. You’ll notice that the map provider (Google, in this case) provides the GetRoute method that we need to create a MapRoute instance. GetRoute ( start, end, false, false, 15 ) Or string start = "Avenida Armando Tivane, Maputo, Mozambique" string end = "Rua 1301, Maputo, Mozambique" MapRoute route = GMap. So, in order to create a route, either do: PointLatLng start = new PointLatLng (- 25.974134, 32.593042 ) PointLatLng end = new PointLatLng (- 25.959048, 32.592827 ) MapRoute route = GMap. If the mapping provider has little knowledge of the area, you’re better off providing coordinate pairs, but it’s likely the route calculating will be bad as well. With a good mapping provider, the string will work. You can specify a route in two ways: by providing a starting and ending latitude/longitude pair, or by providing a string of text describing the start and end points. When a mapping provider has little data on the area you’re showing, your route is likely going to be “as the crow flies”, since garbage in = garbage out. Mapping providers with better data will provide better routes.


When you want to show a route from point A to point B, the mapping provider will calculate the best route, using flags like “avoid highways” or “walking route”. GMap.NET can use a whole slew of providers, but typically (for me at least) Google Maps seems to have the best data. Like the maps themselves, routes are provider-specific. We have a fresh GMap.NET tutorial about maps, markers, polygons and routes that’s updated for Visual Studio 2015 and GMap.NET 1.7! IMPORTANT: You are currently reading our old tutorial. It is assumed that you know how to setup a GMap.NET project, and set your map to your desired location (if not, read through the other tutorial first). Continuing from the previous GMap.NET Tutorial – Maps, markers and polygons on this site, this article shows how you can show a route on your map.
