Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(climate-tool): nearest station select #276

Closed
chrismclarke opened this issue May 21, 2024 · 0 comments · Fixed by #293
Closed

feat(climate-tool): nearest station select #276

chrismclarke opened this issue May 21, 2024 · 0 comments · Fixed by #293
Assignees

Comments

@chrismclarke
Copy link
Collaborator

chrismclarke commented May 21, 2024

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)

picsa app_climate(PICSA) (1)

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.

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants