{"id":21358392,"url":"https://github.com/danzigerrr/toronto-live-bikes-share","last_synced_at":"2026-01-02T18:05:08.524Z","repository":{"id":168395233,"uuid":"642809608","full_name":"Danzigerrr/Toronto-Live-Bikes-Share","owner":"Danzigerrr","description":"Toronto Live Bikes Share Information using the open APIs","archived":false,"fork":false,"pushed_at":"2023-06-21T17:55:33.000Z","size":4041,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T18:34:33.826Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Danzigerrr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-19T11:51:37.000Z","updated_at":"2023-06-03T15:46:07.000Z","dependencies_parsed_at":"2024-03-19T13:40:00.292Z","dependency_job_id":null,"html_url":"https://github.com/Danzigerrr/Toronto-Live-Bikes-Share","commit_stats":null,"previous_names":["krzysztofnazar01/toronto-live-bikes-share","danzigerrr/toronto-live-bikes-share"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danzigerrr%2FToronto-Live-Bikes-Share","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danzigerrr%2FToronto-Live-Bikes-Share/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danzigerrr%2FToronto-Live-Bikes-Share/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danzigerrr%2FToronto-Live-Bikes-Share/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Danzigerrr","download_url":"https://codeload.github.com/Danzigerrr/Toronto-Live-Bikes-Share/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830955,"owners_count":20354856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T05:16:05.991Z","updated_at":"2026-01-02T18:05:08.440Z","avatar_url":"https://github.com/Danzigerrr.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toronto Live Bikes Share Flask Web App \n\n## [Live demo](https://krzysztofnazartoronto.pythonanywhere.com/search_available) of the app\nUse [**this link**](https://krzysztofnazartoronto.pythonanywhere.com/search_available) to check the demo of this application hosted by [Pythonanywhere.com](https://pythonanywhere.com).\n\n\n## The goal of the project\nThe goal of the project is to create a [Flask](https://flask.palletsprojects.com/en/2.3.x/) web application which allows searching for available bikes and docks in Toronto.\nThe application uses live data from the bike sharing system [Bike Share Toronto](https://bikesharetoronto.com/). \n\n### Bike Share Toronto \nThe system offers 24/7 convenient access to 7,246 bikes (6722 mechanical and 524 electric) and 668 stations across Toronto’s vast biking network. \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_1.png\" alt=\"Bike Share Toronto\"/\u003e\n\u003cbr\u003e\nImage source: \u003ca href=\"https://en.wikipedia.org/wiki/Bike_Share_Toronto\"\u003eWikipedia\u003c/a\u003e\n\u003c/p\u003e\n\n\nBike Share Toronto publishes JSON files which updates in real-time by connecting to the Bike Share backend software. The open API transmits live data under the General Bikeshare Feed Specification (GBFS).\n\nIn order to get the live data the following links can be used:\n - [station status](https://tor.publicbikesystem.net/ube/gbfs/v1/en/station_status) - the data describes the capacity and rental availability of the stations. The documentation is available [here](https://github.com/MobilityData/gbfs-json-schema/blob/master/v2.3/station_status.json).\n - [station information](https://tor.publicbikesystem.net/ube/gbfs/v1/en/station_information) - the data contains details about the station including system operator, location, year implemented, etc. The documentation is available [here](https://github.com/MobilityData/gbfs-json-schema/blob/master/v2.3/station_status.json).\n \n \nThe data about the station status and station information can be joined using the identification number of the station.\nThis way the number of available bikes and docks at the particular station can be obtained.\n\n## Installation\n\n### Install virtualenv\n[Virtualenv](https://www.freecodecamp.org/news/how-to-setup-virtual-environments-in-python/) is a tool to create isolated Python environments.\nIt can be installed using the package manager [pip](https://pip.pypa.io/en/stable/).\n```bash\npip install virtualenv\n```\n\n###Create a virtual environment\nIn order to create a virtual environment use the following command. Specify python version and the name of your virtual environment.\n```bash\npython\u003cversion\u003e -m venv \u003cvirtual-environment-name\u003e\n```\nfor example:\n```bash\npython3.10 -m venv venv\n```\n\n### Activate virtual environment\nTo activate your virtual environment on **Mac** or **Linux**, run the code below:\n```bash\nsource venv/bin/activate\n```\nTo activate your virtual environment on **Windows**, run the code below:\n```bash\nvenv/Scripts/activate.bat //In CMD\nvenv/Scripts/Activate.ps1 //In Powershell\n```\n\nWhen your virtual environment is ready and active run the command below to install all dependencies within their own copy of the project. \nUse the package manager [pip](https://pip.pypa.io/en/stable/).\n```bash\npip install -r requirements.txt\n```\n\n## Running the project\nFirstly, generate your API key at [openrouteservice website](https://openrouteservice.org/).\nAfter generating your key, you can find it in the user dashboard.\nCopy it and paste it into the *openrouteservice_api_key.py* file:\n![img.png](readme_images/img_api_key.png)\n\n\nEnter the directory *flask_app/* with file *app.py* and run the Python file.\n```bash\ncd flask_app/\npython app.py\n```\n\nThe application will start on localhost on port 5000.\nYou can see the results entering this link: [http://127.0.0.1:5000](http://127.0.0.1:5000)\n\n## Main functionalities of the app\n### Search for available bikes and docks nearby the specified location\nThe service is available at [http://127.0.0.1:5000/search_available](http://127.0.0.1:5000/search_available).\n\nThe app allows finding K available bikes or docks nearby the given location.\nThe user can specify the following search parameters:\n- Location of the user (latitude and longitude)\n- K value - number of the nearest stations to be selected from all stations\n- Search type - search for stations with available bikes or docks\n\nThe parameters can be inserted into the form:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_2.png\" alt=\"Search for available bikes and docks - search parameters form\"/\u003e\n\u003c/p\u003e\n\n\nWhen ready, the user clicks the \"Search\" button and after a moment receives the results - a map with markers and routes.\nThere are three types of markers: red, blue and green.\n\n#### Red marker\n**The red marker represents the position of the user.**\nThe marker is draggable (hold left mouse button and move).\nAfter clicking on it, its current location is copied as the search parameter (a popup as confirmation appears).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_15.png\" alt=\"Search for available bikes and docks - red marker\"/\u003e\n\u003c/p\u003e\n\n#### Green markers\n**The green marker represents one of K of the nearest available stations.**\nThe station fits one of the states depending on the search parameters:\n- When searching for **bikes** - the station is active, it is renting vehicles, and has at least one available bike - mechanical or e-bike.\n- When searching for **docks** - the station is active, it is accepting vehicle returns, and has at least one available dock.\nAfter clicking on the marker the user can see the details about the station.\n\nThis is an example result when *K* equals 3:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_4.png\" alt=\"Search for available bikes and docks - green marker\"/\u003e\n\u003c/p\u003e\n\n\n#### Blue markers\n**The blue markers represent available stations.**\nThe station is active and has at least one available dock.\nAfter clicking on the marker the user can see the details about the station.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img.png\" alt=\"Search for available bikes and docks - blue marker\"/\u003e\n\u003c/p\u003e\n\n#### Station details\nAfter clicking on a green or blue marker the user can see the details about the station:\n- **Address**\n- **Bikes available**\n- **Bikes available - mechanical**\n- **Bikes available - ebike**\n- **Docks available**\t\n- **Directions** - two buttons (Walking and Cycling) redirect to directions on Google Maps between the user location and the station.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_5.png\" alt=\"Search for available bikes and docks - blue marker\"/\u003e\n\u003c/p\u003e\n\n\n#### Routes to the nearest markers\n**The routes to the nearest stations from the user location are found using [openrouteservice free API](https://openrouteservice.org/).**\nThe closer the station to the user's location, the greener, wider and opaquer it is. \nRoutes to station in greater distances are redder, less wide and more transparent.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_4.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\nOn hover, the route shows a tooltip \"Click for details\".\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_6.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\nAfter clicking the route, its details are shown in a popup.\nThe identification number of the station connected with this route is displayed.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_9.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\n### Search for a convenient connection between two locations using Bike Share Toronto system\nThe service is available at [http://127.0.0.1:5000/search_directions](http://127.0.0.1:5000/search_directions).\n\nGiven a source and destination location, the app presents the route on a map and allows to see it in Google Maps as well.\n\nThe user can specify the following search parameters:\n- Source location (latitude and longitude)\n- Destination location (latitude and longitude)\n\nThe parameters can be inserted into the form:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_14.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\nWhen ready, the user clicks the \"Search directions\" button and after a moment receives the results - a map with **4 markers** and **3 routes**.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_8.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\n\nDuring searching for the most convenient route, the definition of **4 key locations** is needed:\n- **source location** - the initial location of the user; represented with the **red marker**\n- **bike station location** - the location of the nearest station from the source location with at least one bike available; represented with the **orange marker**\n- **dock station location** - the location of the nearest station from the destination location with at least one dock available; represented with the **blue marker**\n- **destination location** - the final location of the user; represented with the **green marker**\n\nSearching for the route includes the following steps:\n- search for route **by foot** from the **source location** and the **bike station location**; represented with the **red route**\n- search for route **by cycling** from the **bike station location** to the **dock station location**; represented with the **orange route**\n- search for route **by foot** from the **dock station location** to the **destination location**; represented with the **blue route**\n\nOn hover, the route shows a tooltip \"Click for details\".\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_10.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\nAfter clicking the route, its details are shown in a popup.\nThe locations (longitude and latitude) connected with the route as well as the profile used during searching for directions are displayed.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_11.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\nOn click, the marker displays a popup with its name - it is one of the **4 key locations** defined above.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_12.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\nAfter clicking on the \"Show directions\" button, the user is redirected to directions on Google Maps\nbetween the source location and destination location using the 4 key locations as destinations (stops) during the route.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"readme_images/img_13.png\" alt=\"Routes to the nearest markers\"/\u003e\n\u003c/p\u003e\n\n## Future improvements\nBased on my experience while using the app, I thought of adding the following functionalities:\n- When searching for bikes, add an option to search for mechanical or electrical bikes only. I think it is quite easy to add - it requires filtering the data stored in the Dataframe before displaying it.\n- Make the markers representing the source and destination locations on the page responsible for searching directions draggable and clickable. Currently, the user has to insert the longitudes and latitudes manually, which can be time consuming and lead to human errors. The location of the marker might be copied automatically when it is clicked - this would be way more convenient and user-friendly. \n- When displaying a route, the time of travel from one point to the other could be displayed. I believe this information is in the response from openrouteservice API, but currently I don’t know how to get it from the response body.\n- Adding different map layers to the maps might be a good idea. The folium.LayerControl() method could be used. This improvement would make the user experience better.\n\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first\nto discuss what you would like to change.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanzigerrr%2Ftoronto-live-bikes-share","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanzigerrr%2Ftoronto-live-bikes-share","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanzigerrr%2Ftoronto-live-bikes-share/lists"}