jeancochrane / mellow-bike-map

🚲 Web app and routing API for finding safe, chill bike routes. Like Google Maps if it took you through cozy side streets.
https://mellowbikemap.com
MIT License
13 stars 5 forks source link

Display distance and time estimates for routes #30

Closed jeancochrane closed 3 years ago

jeancochrane commented 3 years ago

Overview

Use the combined length of the route fragments in meters to display a distance and time estimate when a user searches for a route.

Closes #27.

Demo

2020-10-09 13 07 32

Testing instructions

jeancochrane commented 3 years ago

Overall I like this, but I recreated a few routes in google maps for comparison and got pretty different results for distances (e.g. from pilsen to washington park google said 8.4 miles and mbm said 6.4). Any idea what might be causing that?

I appreciate this thoroughness! I'm not immediately sure where the error is but the part I'm most uncertain about is how the length_m column is being generated. I'm going to do some digging this weekend and see if I can surface the source of the discrepancy.

jeancochrane commented 3 years ago

I finally got to the bottom of the incorrect length calculation! The details: it turns out I had forgotten to use DISTINCT when joining the route fragments to the MellowRoute table in the get_route() query, which created duplicate segments in the output in cases where one OSM ID was used for more than one MellowRoute (pretty common at the edges of neighborhoods, where the bounding box of one neighborhood often overlaps with another in the route marking interface).

Want to double check to make sure that the routes you tested show the correct distance now @kalilsn?