High school Environmental Club project that finds the average distance each student commutes to school
My High school's Environmental Club was doing a project to caclulate how much gas everybody uses by driving to school every day. This little Python script I made lets you input a file with everybody's address (I got this file through downloading a PDF of the school directory, converting it to a txt, and running grep), and uses the Google Maps API to determine how much people drive.
- Download by running
git clone https://github.com/jaredgoodman03/distancetracker.gitin your terminal or pressing "download zip" on this Github page. - You'll need python3 and pip3 to install packages. Downloading these is left as an exersise for the reader.
- Install this Python library by running
pip3 install -U googlemaps. - You'll need a Google Cloud API Key - the package mentioned above has great instructions. Make sure to enable the Directions API.
- Copy and paste your API key into params/API_KEY
- Enter the path of your file to process in params/FILE_PATH. It should have one address on each line.
python3 create_dump.pyto output the distances of each address into a new file called distancedump.txtpython3 calc_average.pyto get basic stats about your data.- Make a cool graph (text files can be imported into Excel or Libreoffice pretty easily)