I am making a bus management system (school project) and I'm having trouble with drawing routes on a map (Leaflet).
Right now I have a sql database of gtfs data. In order to draw routes I dynamically create a geojson that contains the various coordinates of the shapes table and then just connect those points using leaflet. The result is a mess with lines that connect points with no criteria and order. I suppose it's a problem with the sql query to the db. So here are my questions:
Which tables are necessary to draw a route? (shapes? stops? both? others?)?
What's the query to extract the coordinates I need in the right order to be drawn correctly?
Is there a better way to do this?
Here's an image to illustrate the problem better (it's just a representation of the issue because I don't have access to the project right now): image