Project Brief
Let’s start the week by using Python to create a map of all car accidents that occurred at T-intersections across the US in 2022. You are recommended to use the Folium library for this. With Folium you can build interactive web-based maps.
Expected Output
Your program should generate an HTML file. The HTML file should show the following interactive map when opened in a browser:
As you can see, we have used clustering here due to having too many points to display all at once. Each blue marker represents the location of an accident. When the user clicks a marker, information about the accident pops up. This information is taken from the MAN_COLLNAME column in the data. You can download the data from this Google Drive link. The data contain all the accidents at T-intersections across the United States in 2022 and they include latitude and longitude coordinates for each accident. The data were downloaded from the National Highway Traffic Safety Administration (NHTSA) website: https://www.nhtsa.gov/file-downloads?p=nhtsa/downloads/FARS/
Environment Setup Instructions
Install the required libraries with:
pip install folium pandasRun the app with python main.py and an HTML file should be generated in the project directory. Double-click that file to open it in the browser to see the map.
Resources
Learn how to use the Folium library from the official documentation:
https://python-visualization.github.io/folium/latest/
Project Solution
Feel free to post your questions or comments in the comment section below.
Happy Coding!
Daily Python Projects Team
Got it!
This was pretty neat!
https://drrawley.github.io/codespaces-jupyter/DailyPythonProjects/accidents.html