GSOC 2018 work on PT Assistant
Posted by Biswesh on 7 August 2018 in English. Last updated on 14 August 2018.This is a gist of all the work that was done during the summer of 2018 under Google Summer Of Code (GSOC) to further improve the PT Assistant plugin which assists mappers in mapping Public Transport systems.
Aim of the Project
To further improve the plugin in a way that it helps mappers in mapping public transport systems with ease. The assistant should become smarter by the end of GSOC and should act as a true assistant with smarter decision making capabilities.
Final Result
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, Double splitter, smarter Roundabout splitter etc. All the major achievements of this summer have been listed below :
Addition of Routing Helper button to the Relation Editor
A new button in the Relation Editor which aims to help mappers in fixing all the problems in a relation using options that the helper provides.
The Routing helper runs through the selected relation once the button in the relation editor is clicked. It searches for any kind of violation in the existing ways such as one way direction violation or overlapping of ways etc. Then it gives users options to remove those ways and suggests them some solutions in the form of options. The helper also checks if there is any gap present in the relation and thus it also tries to fix them by giving the suitable list of possible solutions as options which the mapper can select to make the relation correct. So the mapper now doesn’t need to care about the ways that are valid and that can be added as the helper already checks the validities and only then does it give any suggestion.
The image above shows how the helper provides the options(1, 2, 3) to the mappers and they can just select one of them by pressing that button and those ways gets added to the relation automatically. Here white way is the current way and the grey way is the next way where the route has to go.
Another feature of the helper is that it also compares the ways with the other relations and gives an alternate solution based on those relations. We can change our set of options to that mode by pressing 0. Below is an example where the route helper is showing the ways from other relations.
The images below show how the helper detects an error and gives options to the mapper to opt for a solution.
More about the button can be found here.
Addition of Double Splitter Map Mode
A Map mode which splits a given way(s) into 3 or 4 parts in which one can choose the tags that can be given to the ways that got split. It can be used on a single way, or on 2 adjacent ways to either split in 3 parts, or in 4 parts respectively. The mapper is then presented with a dialog for adding tags to the middle section.
More about the map mode can be found here.
Addition of PT Wizard
To help setup the JOSM editor a Wizard was created. It is a wizard which helps a mapper in making decisions regarding important features of PT Assistant plugin. One can go through the entire wizard by clicking on ok and choosing the appropriate options which suit their personal need.
Major improvements to Roundabout Splitter
- The Roundabout splitter now correctly splits the roundabouts for the buses. Previously it used to violate oneway traffic, but now it works correctly.
- The map mode now also works for cycle ways which were a lot more complex compared to buses. It has been a successful new feature to the splitter.
And if it can’t find a solution then it opens the affected route relations for inspection.
Improvements in Edge Selection Map Mode
- The multiple select option was added to the map mode which uses shift and ctrl to multi select and toggle.
- The edge now also considers the mode of transport.
- New rules were added. eg. stop position should end an edge.
- Single common way between multiple edges now automatically get selected
Addition of Transfer of details of Stop to platform node using cursor position
Three new shortcuts with slightly different functionalities were added in which the stop/platform details got transferred to the platform node (which gets created on the place where the cursor is currently present).
These 3 new shortcuts are -
- shift + g
- ctrl + g
- alt + ctrl + g
Addition of New Public Transport menu on Tools menu
A new menu called Public Transport is now on the Tools menu which contains all the important actions related to public transport.
Addition of new PT Assistant Preference Tab
User settings are now stored under Edit => Preferences => PTAssistantPlugin settings.
Code Base
-
The entire code for the PT Assistant plugin can be found in https://github.com/JOSM/pt_assistant.
-
My contribution can be found in https://github.com/JOSM/pt_assistant/commits?author=biswesh456
-
But since we changed our version control in the second half of GSOC, many of my commits are not mapped to my username of Github as we were using svn. But my previous commits can be found under the username biswesh here: https://github.com/JOSM/pt_assistant/commits/trunk?after=7bac4fab4b8d36da583d066a63031d661237cffb+69.
-
This is because my Github username is biswesh456 while my svn username is biswesh.
Timeline
First Period (May 14 - June 9) :
-
Added the new PT Assistant Wizard. Code - https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/PTWizardAction.java
-
Added the Double Splitter Map Mode. Code - https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/DoubleSplitAction.java
- Worked on Transfer of details of Stop to platform node using cursor position. Code -
- https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/CreatePlatformNodeThroughReplaceAction.java
- https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/CreatePlatformShortcutAction.java
- https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/ExtractPlatformNodeAction.java
- Worked on Edge Selection Map mode to add Multiple selection option using shift and ctrl, add mode of transport based selection, other changes. Code - https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/EdgeSelectionAction.java
Second Period (June 12 - July 7) :
-
Added the Routing Helper Button to the Relation Editor. Code - https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/MendRelationAction.java
-
Worked on improving the Roundabout Splitter Map Mode. Fixed some known bugs in the map mode and added functionalities to split for cycle ways as well. Code - https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/actions/SplitRoundaboutAction.java
Third Period (July 10 - August 14) :
- Fixed Bugs, Added new features in Mend Action (Route Helper) button
- Added Public Transport menu to Menu bar
- Added PT Assistant Preference Tab. Code - https://github.com/JOSM/pt_assistant/blob/trunk/src/org/openstreetmap/josm/plugins/pt_assistant/PTAssistantPluginPreferences.java
Challenges Faced
There were many challenges that I faced during the program. Some of the challenges I faced are -
- One of the biggest challenge was to deal with the large code base and understand them to some extent so that I can use them in my code.
- Another challenge which I faced was when I was working on the routing helper. There many cases which needed to be taken care of. Initially the helper used to suggest a lot of wrong answers and was buggy but with time it started becoming more reliable and less buggy. Now it is at a stage where it is expected to give correct suggestions after taking into account all possible conditions and also it doesn’t seem to crash that often.
- Enhancing the roundabout splitter to include the cycleway was also a huge challenge due to its complexity. It again had the same issues where a lot of corner cases needed to be taken care of but finally it seems to work fine.
- Initially the creation of wizard was also a difficult task as I had to make changes to some core functionalities from the wizard. Some of the changes were never designed to be changed from a plugin. This created some problems, but on solving each of them step by step we were able to make the wizard a success.
Overall Experience
It has been a great experience working with an amazing mentor like Jo(Polyglot). I would also like to thank Michael Zangl for his support in resolving all the technical issues I faced throughout the summer and also to Florian Schäfer who helped a lot in shifting the code from SVN to Git. Also a special thanks to Google for giving me such an opportunity to work with organisation like OpenStreetMap.
Discussion
Comment from gileri on 13 August 2018 at 21:04
Thank you for your hard work !
Comment from Biswesh on 13 August 2018 at 21:09
Thanks @gileri for your comments. The diary is not yet complete and a lot many features which got added would soon be elaborated in the coming week.