GSOC 2018 Making pgRoutingLayer plugin compatible with QGIS 3 and adding additional GUI support - pgRouting/pgrouting GitHub Wiki

Table of Contents

Project

Biography

Brief Idea about the project

The new version of QGIS has introduced an API break. The key changes in QGIS 3.0 are as follows:

  • Updated from Qt4 to Qt5
  • Updated from PyQt4 to PyQt5
  • Updated from Python 2.7 to Python 3.0
  • QGIS API is improved , many classes have been deprecated or renamed.

The above changes have implications that the pgRoutingLayer plugin is no longer compatible with QGIS 3.0 . For my GSoC project I propose to accomodate these changes in pgRoutingLayer plugin code and also make use of the new features introduced in QGIS 3.0 to improve the functionality of plugin’s GUI. Also I propose to add functionality for the proposed stable functions of following families:

  • Astar : pgr_astarCost , pgr_astarCostMatrix
  • Bidirectional astar : pgr_bdAstarCost , pgr_bdAstarCostMatrix
  • Bidirectional Dijkstra : pgr_bdDijkstraCost , pgr_bdDijkstraCostMatrix
  • Flow

State of Project Before GSoC 2018

The current state of the pgRouting is not compatible with the new version of QGIS. The plugin is written in python 2 . It uses PyQt4 as python binding for Qt4 . There are proposed stable functions scheduled for the next major release. Current plugin has no functionality for these functions.Also there is no test coverage for the plugin code.

Branch

https://github.com/pgRouting/pgRoutingLayer/tree/gsoc/python3

Timeline

Pre-bonding period

These are the things I did while applying for GSoC

  • Documented the pgRoutingLayer plugin code.
  • Refreshed object oriented programming concepts.
  • Refreshed SQL concepts.
  • Read , documented and ran the pgRouting code on my machine.
  • Read pygis cookbook and made a sample plugin.
  • Studied the basics of Qt , PyQt .
  • Studied about unit tests and wrote few tests for sample plugin.
  • Read QGIS-api break , Qt5 , PyQt5 documentations.
  • Read articles about porting QGIS plugins.
  • Setup QGIS 3.0 environment on my machine.

Community Bonding Period

Following tasks are planned to be done during 23rd April to 14th may.

  • Get in touch with the community, mentors, and introduce my project to them and receive early feedback.
  • Set up wiki page to maintain weekly progress and other information of the project.
  • Study the PyQGIS cookbook and other resources to better understand the pgRouting code.
  • Study the differences between Qt4 and Qt5 and maintain a list of these differences which are relevant to pgRouting code.
  • Study the differences between PyQt4 and PyQt5 and maintain a list of differences specific to pgRouting code.
  • Study the QGIS Api-break documentation and create a list of changes required in pgRouting code .
  • Study the signatures and documentation of proposed functions.

Official Coding Period Phase 1 (May 14 to June 10, 2018)

Week 1 (May 14 to May 20, 2018)

Write Unit test for following files

  • Unit test for QGIS environment

  • init.py

  • pgRoutingLayer_utils.py

    Week 2 (May 21 to May 27, 2018)

    Write unit test and test the following files: updated **

  • ** Instead of writing tests prior to migration, decided to write it after migration. **

  • Change one file using python 2to3 as well as qgis2to3 and discuss the differences.

  • All function files

    Week 3 (May 28 to June 3, 2018)

  • Remove wildcard imports from every file to make it compatible with qgis2to3.

  • Use qgis2to3 and proposed method (mentioned in proposal) to port files to python3.

  • Remove translational errors.

Week 4 (June 4 to June 10, 2018)

  • Buffer period ( for resolving errors and making small python scripts for Qt migration )
  • Prepare work for Phase 1 submission along with a brief Phase 1 report.
  • Prepare Pre-Phase 2 synopsis .

First evaluation period (June 11 to June 15, 2018)

  • Deliver a working code which is compatible in python 2.7 and 3.
  • Evaluation of first phase work.
  • Discussion of phase 2 strategy.

Official Coding Period Phase 2 (June 11 to July 8, 2018)

Week 5 (June 11 to June 17, 2018) ** updated **

  • Make changes as suggested in feedback.
  • PyQt5 changes.
  • Use qgisAPIfinder to get API differences and analyse the results.
  • Start API changes.

Week 6 (18th June-24th June)

** Decided to manually read the document and apply changes **

  • API changes to pgRoutingLayer.py
  • API changes to function files ( files that do not use dbConnection.py)

Week 7 (25th June – 1st July)

  • API changes to rest of function files.
  • Changes to dbConnection and PostGIs files.

Week 8 (2nd July – 8th July)

  • Resolve errors and any issues which may arise.
  • Prepare work for Phase 2 submission along with a brief Phase 2 report.

Second evaluation period (July 9 to July 13, 2018)

  • Deliver a working code compatible with Qgis 3.0.
  • Mentors evaluate me and I evaluate the mentors .
  • Discuss with mentors further refactoring and additional features to be added.

Official Coding Period Phase 3 (July 9 to August 5, 2018)

Week 9 (July 9 to July 15, 2018)

  • Work on the feedback provided after the second evaluation
  • Finalize the transition.(if remaining) .

Week 10 and 11 (16th July –29th July)

  • Documentation
  • Write test and test the code.

Week 12 (July 30 to August 5, 2018)

  • Code functionality for proposed functions.
  • Prepare for final delivery.

Final evaluation period (August 6 to August 14, 2018)

  • Wrap up my projects and submit final evaluation of my mentors.

Reports

Bonding

Hand written copy of OSGeo mail