GSoC 2019 Project: Pt-assistant Final Report
Posted by ashish123 on 19 August 2019 in English. Last updated on 20 August 2019.This is a gist of all the work that was done during the summer of 2019 under Google Summer Of Code (GSOC) to further improve the PT Assistant plugin which assists mappers in mapping Public Transport systems as well as Bicycle and hiking itineraries.
Aim of the Project
To further improve the plugin in a way that it helps mappers in mapping public transport systems as well as Bicycle itineraries with ease and a lot of further changes to make the plugin more helpful and flexible to the mapper. The assistant became more user-friendly and should act as a true assistant with smarter decision-making capabilities.
End Results
The plugin is now much more capable, processing the data in the background and presenting the result to enable the mappers to make decisions especially with new features like routing helper for bicycle, the extended data model for public transport, and some new key functions in old routing helper. All the major achievements of this summer have been listed below :
Extending routing helper for bicycles
Previous Routing Helper was dedicated to public transport so my task was to extend it further for Bicycles. As Bicycle follows the original mapping model for route relations, they are different than the route relations for public transport. Bicycle routes contain “forward” and backward roles on its ways to separate branches were traversing the route in one direction differs from the route in the opposite direction. The order of the member ways is different than pt-routes. So the basic idea of the router was the same first it starts from the beginning of the route and checks for gaps in the route and at every step, it checks for the validity of the current traversing way and if it finds something wrong it shows users options to fix that.
when routing helper finds any invalid way it suggests some fixes
when closing a loop it assigns the forward and backward roles as needed, depending on the direction of the individual ways.
Addition of option 8 for splitting the white edge
The way before a gap is colored white, the way after a gap is colored gray.
Sometimes this white way doesn’t need to be used completely. Before one had to split it manually and restart the routing helper. Now using option 8 it will suggest all possible sideways from every internal node one by one and when you select such a sideway, it will automatically split the way from that node and add the selected option to the relation table. e.g when you press 8 it will suggest you a number of possible options to split the way and select your option.
when you select your way then it will split the way on the selected node.
Major Improvements in sorting pt-route members
As previously sorting of PT-members was not able to detect the wrong (traffic) side stops and after sorting some of the stops were getting repeated along with the way it served. Now after sorting that difficulty has been removed and it also detects the wrong side stops and ask mapper to remove it or not it will also take care of the stops which can be served in the selected route relation if it can be served then it checks its validity otherwise it will ask permission to remove that stops.
Extended data set
There have been a lot of changes in the data model of PT-assistant. Now you can find the nearest stop (serving stops) to a particular way and the nearest way (adjacent way) to a specific stop. from the current downloaded dataset, you can find all stops and their nearest ways and vice-versa. Also, every way and stop will store their corresponding stops and ways respectively as well as their serving side (e.g right side stops or left side stops according to the direction of way)
Breaking relation into edges
Now Every relation of the current downloaded dataset can be broken into edges where every edge will be made of several ways which are serving the same set of relations and from every edge, we can find the number of stops it is serving as well as their side of serving way(left side or right side) they contain a color which will change according to their number of ways and try to make a rainbow. It will help the user to visualize the data more easily. After every download, it will compute the edges again and will change the dataset
Code Base
- The code for the PT Assistant plugin can be found in https://github.com/JOSM/pt_assistant.
- I have sent two big PR in which one got merged and another one is still pending my GitHub handle is Ashish-uzumaki
- My contribution details
- PR was created by me and got merged Merged PR commits
- All changed files link
- PR still have to be merged Pending PR commits
Timeline
First Period(27 May - 28 June)
- Extended the routing helper for bicycle route relations. link to code Bicycle Route Relation
- Fixed the problem of backward and forward in bicycle route relations.
- Changed the structure of code for better usability.link to code Routing Action
Second Period (28 June -22 July)
- Extended the data model for pt-assistant for PTStops. link to code PTStops data
- Extended the data model of PTWays. link to code PTWays data
- Made the Edge class for breaking the relation into edges.link to code Edge
- Handling the Edges and their stops.link to code Edge data manager
Third period (23 July-18th Aug)
- Recoded the Sorting of Pt-route members class.link to code Sorting of pt-route members
- Added the 8th option in routing helper for splitting the white edge.link to code split white edge
Challenges Faced
In the start of the program, I was struggling with a very large codebase as It was my first experience working for an open-source organization. Another challenge which I faced was when I was working on the Bicycle Router and splitting the white edge. I had to deal with lots of exceptional cases in bicycle routes such as assigning forward and backward roles, getting suitable ways for bicycle and so many other corner cases but after lots of testing, it became very reliable.
Overall Experience
I really enjoyed the work with the support of some amazing mentors it was really fun to solve some difficult problems. As it was my first experience working as an intern in an open-source organization I learned a lot. firstly I want to thank Openstreetmap for providing such great mentors. It has been a great experience working with an amazing mentor like Jo(Polyglot). I would also like to thank Michael Zangl, Francois de Metz for his support in resolving all the technical issues I faced throughout the summer. Also a special thanks to Google for giving me such an opportunity to work with an organization like OpenStreetMap.
Discussion