Is there a way to highlight roads using leaflet?

3k Views Asked by At

I have a complete set of waypoints (beginning, end, every intersection) and I'd like to display this on a map. I don't want to use a routing service and it should be offline.

How can I draw polylines on a map so that they follow the curves of the road? I'm using leaflet.

Could the data be extracted from a relational database(PostgreSQL) and then convert it into GeoJSON and display on the map by leaflet?

I can't use any paid services either.

2

There are 2 best solutions below

0
On

Leaflet has a polyline object. MapBox has a nice example how to use it.

0
On

I think scai has given you a good example to practice.By the way you can also store the data in JSON format in PostgreSQL.Refer this documentation for more details.JSON Types