metrics-mvp
metrics-mvp copied to clipboard
Metrics should be calculated in the metric system
In order to make the metrics app a global application, we should calculate all metrics in the metric system rather than the imperial system. There is less room for error and more sanity checks available along the way to ensure everything actually does what it should be doing. This will also help to add in international sources of transit data, and encourage contribution from more people around the world.
That being said, the imperial system is still useful in America, so we should use a conversion library to convert the statistics on the frontend render time to imperial for American users with a toggle that is automatically toggled on for US users. Hopefully one day soon we can remove this feature and wish the imperial system a fast, painful death. :)
++ will probably work on this soon as it's needed for supporting Canadian transit agencies. I'm thinking of a toggle that defaults to mph for American agencies and km/h for all others. Using IP geolocation might work too (https://freegeoip.app), let me know your thoughts.
Also GTFS uses metres for storing distances, it's the backend that converts speeds to mph if it's provided in the query, so we could request km/h and do the frontend calculations in metric and convert to mph if needed.
Alternatives to using an external API:
- We could bind the transit agency to a default unit system that automatically toggles on the unit conversion switch.
- We could bind the USA in a relatively simple lat/long coordinate bounding box + and use the browser geolocation API
- We generate a lat/long polygon for the shape of the USA (and other countries that use mph) + and use the browser geolocation API
πΊπΈπΊπΈπΊπΈπΊπΈπΊπΈ WE DONT NEED NO METRIC SYSTEM π¦ π¦ π¦ π¦ π¦
But actually, we can add an option (stored in cookies/localstorage/whatever) that lets users choose between metric and imperial. We need a settings menu for the app, anyway.