You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We are expecting to add a large number of additional stations to the E-PICSA app, and as such selecting the correct station for a user may be difficult. It would be better if the app can automatically recommend which station to use, selecting the station that is closest to the user
Describe the solution you'd like
When loading the climate too site-select page the app should request the user's approximate location, and use that to calculate which site is closest. This should then automatically pick that station (but still give the user the option to select a different one)
Additional context
See capacitor documentation for implementing Geolocation API
There are many ways to compute distance between 2 points (e.g. user current location and each station to determine what is closest). The simplest method would be to take the difference in coordinate values to calc longitdue and latitude differences (delta-x and delta-y), and use as 2 sides of a right-angled triangle to calculate the hypotenuse.
This won't be entirely accurate due to curvature of the earth, but should be a reasonable estimation. Alternatively could look at exact distances using functions built into leafletJS (e.g. https://leafletjs.com/reference.html#map-distance), or search online for formula (e.g. https://stackoverflow.com/a/51819649). These will be more computationally expensive so probably best to work out simple distances first.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We are expecting to add a large number of additional stations to the E-PICSA app, and as such selecting the correct station for a user may be difficult. It would be better if the app can automatically recommend which station to use, selecting the station that is closest to the user
Describe the solution you'd like
When loading the climate too site-select page the app should request the user's approximate location, and use that to calculate which site is closest. This should then automatically pick that station (but still give the user the option to select a different one)
Additional context
See capacitor documentation for implementing Geolocation API
There are many ways to compute distance between 2 points (e.g. user current location and each station to determine what is closest). The simplest method would be to take the difference in coordinate values to calc longitdue and latitude differences (delta-x and delta-y), and use as 2 sides of a right-angled triangle to calculate the hypotenuse.
This won't be entirely accurate due to curvature of the earth, but should be a reasonable estimation. Alternatively could look at exact distances using functions built into leafletJS (e.g. https://leafletjs.com/reference.html#map-distance), or search online for formula (e.g. https://stackoverflow.com/a/51819649). These will be more computationally expensive so probably best to work out simple distances first.
The text was updated successfully, but these errors were encountered: