-
-
Notifications
You must be signed in to change notification settings - Fork 186
Example Project :GIS-Based Traffic Simulation with Mesa #160
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
Conversation
|
Good start, looks like it's scoped a lot better! A few points:
|
sir I can make but it required visuvalization server |
|
Sorry I don't understand what you mean. |
|
sir in model and class it will show direct output no visuvalization like step , start and stop
Sir, the notebook I wrote by myself is small and easy. |
|
Yes, that's both good. Just put the model code and agent code in separate files ( |
|
ok sure sir |
|
@wang-boyu could I get your perspective of the use of the gis/space in this example? |
|
Sir, I wanted to know if I should remove the large code sections from the notebook after using |
|
Yes, that's indeed the idea. |
|
Structure looks good! What's in |
|
It’s not a structuring problem, but within the model code itself. Without sharing the latest version of the code I can’t help you. |
for more information, see https://pre-commit.ci
|
sir i added the code |
|
@EwoutH thank you sir its working in different notebook |
| self.G = G # Assign the OSMnx graph to the space | ||
| self.crs = crs # Coordinate Reference System | ||
|
|
||
| class VehicleAgent(mesa.Agent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
for more information, see https://pre-commit.ci
|
done sir please check it |
|
sir If you don't mind can talk at google meet sesion please |
|
Do you mind me fixing a few things for you? |
|
no sir it want be any problem |
for more information, see https://pre-commit.ci
@EwoutH sir like what i have add in jupyter notebook |
|
I can only see the updated Readme. |
|
Sorry sir i m asking what i have to add in notebook |
I think those are the most important. |
Sir, should I create code and a simulation? If I do, it might become messy. |
|
Let me take a better look once we have gboeing/osmnx#1209 figured out. |
|
Sir is that sufficient |
|
sir i wanted to know is there any Discord server for communication |
We have a matrix chat: https://matrix.to/#/#project-mesa:matrix.org I want to let you know we figured out the issue in GeoPandas: It was an incompatibility between Shapely and the new NumPy 2.1.0 release. So I got the model working on my end again, and will try to further review this PR this evening (CEST). We're getting close! |
|
@EwoutH ok sir, I hope this time I'm going in the right direction. |
|
Yes, it will take a little bit more cleanup, but it's a huge improvement from before! |
|
@wang-boyu @tpike3 this PR uses a custom visualisation using folium and selenium. It's quite heavy, taking around 20 seconds to save each image for each step (200 sec for 10 steps)! The results is a gif like this: Is that acceptable for the GIS examples? |
|
@PRIYANSHU2026 what I fail to grasp is that the Readme describes the model looking into traffic congestion, but nowhere in the model congestion is actually implemented. |
|
@EwoutH sir, It describes how vehicles move in a particular lane. If we include more than 200 vehicles, the actual implementation will show how vehicles replace each other at specific adjust in traffic points and how they move forward, especially in urban areas, when observed step by step. |
I see nothing in the code that indicates that vehicles would be moving slower once there more on a link / route. Could you point me to that part in the code? |
|
I went thought it line by line. Please point me to the specific part. |
|
PRIYANSHU, you need to learn to say "I don't know". It's incredibly important to be able to admit that you don't know something in science, because otherwise you have to start making things up, and then facts and guesses get mixed up. I'm closing this PR, because you clearly don't understand your code base. I would recommend taking a break from open-source contributing. If you want to return to it, try to:
Unfortunately, my time budget for guiding and reviewing this kind of PRs is empty for the next months, so I won't be able to further review PRs. No hard feelings, but this just doesn't work this way. If any other maintainer wants to pick this up feel free to reopen the PR. |
|
@EwoutH ok sir being honest i am working and improving my self but definitely you pointed my deficiecny and i will work on that thank you for your guidance i very happy to getting mentored by @EwoutH may be it blind me for Gsoc 25 but from this PR i have learn how to improve my self and how you have help me to correct the code and you also got Bug in OSMnx. Thank you again now i will learn my core skill and communication .
?? |
|
And I m requesting to All mentor of Mesa @jackiekazil @rht @wang-boyu @tpike3 please look on this PR as model working fine but i didn't described Read me and code properly And again special thanks to @EwoutH for guidance and help at every stage. |
|
@jackiekazil @rht @tpike3 @wang-boyu are you there i am waiting your response |







GIS-Based Traffic Simulation with Mesa
Overview
This project simulates urban traffic congestion using the Mesa agent-based modeling framework and OSMnx for extracting road network data from OpenStreetMap. It visualizes traffic patterns and congestion in a critical urban area in Bangalore, India. The simulation includes different vehicle types and their movement on the road network, and the results are animated into a GIF to showcase the traffic dynamics over time.
Why We Need This
Problem Definition
High vehicle density and complex road networks are significant contributors to traffic congestion in Indian cities, especially in densely populated urban areas. This issue affects millions of travelers, leading to:
In cities like Bangalore, also known as the Tech Hub or Silicon Valley of India, these problems are exacerbated by rapid urbanization and technological growth.
Objective
By developing and refining this traffic simulation project, we aim to deliver more effective and adaptable solutions for managing traffic congestion in Indian cities. The project has the potential to:
Features
Key Contribution of Mesa
Mesa provides a straightforward and efficient framework to create, manage, and simulate the movement of vehicles on a road network. It allows for the simple creation of agents (vehicles) that follow predefined paths, interact within a given space, and produce simulation results without unnecessary complexity.
Mesa is used because it enables you to build a functional and effective traffic simulation without overcomplicating the model. Its integration with other libraries like OSMnx and NetworkX ensures that the model remains easy to understand and maintain, focusing on delivering practical insights rather than adding complexity.
Requirements
pip install osmnxpip install networkxpip install foliumpip install mesapip install pillowSetup
Clone the Repository
Install Dependencies
Usage
Update Bounding Box Coordinates
Modify the
north,south,east, andwestvariables in the script to reflect the area you want to simulate.Run the Simulation
Execute the script to run the traffic simulation and generate the animated GIF:
View the Results
The resulting animated GIF will be saved in the
Datadirectory. You can view it directly from your file explorer or display it within a Jupyter Notebook using:Code Overview
Future Work
The project can be extended to address the following aspects:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments