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

Give elevation points #23

Open
gabrieljaegerde opened this issue May 7, 2021 · 0 comments
Open

Give elevation points #23

gabrieljaegerde opened this issue May 7, 2021 · 0 comments
Assignees

Comments

@gabrieljaegerde
Copy link
Owner

As of now, users only get points for the distance they accompany me for. Since I go much slower uphill, it would be nice to also introduce a metric that has to do with elevation: elevation points.

Possible course of action:

  1. Write a function to retrieve the elevation at a given point.
    below is a quick example. This uses the geocoder package. I did not do research into other packages and it might thus not be the optimal one.
import geocoder
def get_elevation(self, lon, lat):
    g = geocoder.elevation([lat,lon]) 
    return g.meters

**look into the order of lat,lon in geocoder (some packages to lat,lon others lon,lat)

  1. Wherever we append to locations_during_song (def location(self, update, context) and def handle_location_tracking(self, chat_id)), also include the elevation at the current location like so:
current elevation = self.get_elevation(lon, lat)
self.locations_during_song.append(
                {
                    "lon": self.current_lon,
                    "lat": self.current_lat,
                    "time": datetime.now(pytz.utc).__str__(),
                    "elevation": current_elevation,
                }
            )

when the total distance is calculated (currently def calculate_distance(locations_during_song)), also calculate the total elevation that the song has accompanied me for. That function name should then probably be changed to: calculate_distance_and_elevation. Save the total elevation into the locations.json too as elevation_difference.

Note that the elevation points can also be negative if the user has accompanied me on mostly downhills :D.

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

No branches or pull requests

2 participants