Hi, I will be getting a set of lat, longs from the client. I need to connect those points using a free line. I used the polyline feature in the leaflet library. I only get a straight line. I want to draw a line that highlights the road. Thank you. asked 10 Feb, 03:27 Poojitha |
To get a route following roads between points, you need to use a routing engine. There are several such engines available that you can query for free for light use. For more intensive use, you will typically need to pay. Engines you could consider include Graphhopper and OSRM (the best free service for the latter is at https://routing.openstreetmap.de/about.html ). Typically you will send an AJAX/fetch request to the routing engine server with your lat/lons, and it will return a polyline which you can draw with Leaflet. answered 10 Feb, 10:50 Richard ♦ |