GSOC 2014 : Schematization Plug-in for QGIS

I am Nishith Maheshwari from IIIT Hyderabad, India and have been accepted for Google Summer of Code 2014 for the project Schematization Plug-in for QGIS. I am very excited and looking forward to working on the project. This wiki page will have general info and regular updates of the progress of the work.


The aim of the project is to add some functionality to create schematic maps in QGIS. This would be done by creating a plug-in which would have various map generalization/schematization functions implemented in it.
More detailed proposal is at -
A more detailed report of the project can be found at -


  • Mentor : Luciene Delazari
  • Co-mentor : Piotr Pociask
  • Co-mentor : Mark Ware

Tutorials and Resources being used

Github Repository :


Documents, examples and datasets

Setup Instructions

How to Install

  1. Clone the repository or download the zip file from and extract it.
  2. Copy and paste the folder in the '.qgis2/python/plugins/' folder which would be in the home directory of the user (this is same for both Windows as well as any Linux system). Also change the name of the folder to 'schematization'.
  3. Now in the QGIS this plugin would show under 'Manage and Install Plugins' and would just needed to be activated there. (As this is an experimental plugin, please make sure that you have the 'Show also experimental plugins' box checked under the 'Settings').

How to use

  1. One would be 'Algorithms for simplifying layer' under which the 'Topology Preserving Simplifier' algorithm is there. This algorithm takes as input a line vector layer and returns a simplified form of the input while preserving the topology.
  2. The other group 'Algorithms for applying constraints' will have 'Applying Angle Constraints'. This algorithm applies the angle/direction constraint on the simplified layer (obtained from 'Topology Preserving Simplifier' algorithm). The constraint is applied in a manner such that the final output has lines oriented in either horizontal, vertical or diagonal direction. This satisfies one of the conditions for schematization and makes the map easier to read and understand.


Before Coding Period
  • Setup of coding environment Eclipse and Pydev done!
  • During the bonding period it was decided after discussions with the mentors that we would create the plug-in by integrating it with the already existing functions of Processing Toolbox.
Week 1
  • For simplification of geometry, QgsTopologyPreservingSimplifier class will be used as the implementation is similar to Douglas Peucker algorithm and also gives us the advantage of preserving the topology. There were some errors in the output for some data sets but otherwise it is working good enough. Those errors are reduced after joining/merging the lines at intersection before simplification.
  • After these things have been decided, now the first task at hand is to implement a basic plug-in which removes objects smaller than a certain threshold. This would be the initial setup for the plug-in and act as a base for it. This function for removing the smaller objects might create topology errors, so this would be available as an option in the plug-in.
  • Different algorithms will be connected using models for testing purposes. Also for testing, fake QGIS instance is available at QGIS Interface
Week 2
  • There is exampleprovider which is available in the Processing plugin as an example plugin to add algorithms to the Processing framework. This will be used as a base.
  • Have added the functionality for simplification using QgsTopologyPreservingSimplifier function in the above mentioned example plugin. But this alone is incomplete/insufficient for simplification as there is a need to do pre-processing otherwise the output won't be as desired.
  • In the coming week I'll be tweaking with the models given in processing toolbox and using the algorithms already in it will implement proper pre-processing steps in the plug-in.
Week 3
  • Solved tickets/issues which were created by the mentor on GitHub. It included addition of progress update (in terms of percentage) while running the algorithm and also an option for user to set the threshold for simplification (instead of using a predefined value).
  • Have added the pre-processing steps of dissolving and converting multiparts to singleparts in the plug-in itself after testing the algorithms using models. These algorithms of processing toolbox are called within the SimplificationAlgorithm.
  • In the coming week I'll be trying to add the tests suites for the plug-in which will be helpful for testing the current features as well as for future testing purpose.
Week 4 and 5
  • Tested the working of algorithm on various data-sets and checked their result.
  • Implemented a basic unit test for checking whether our algorithm is running correctly as expected by counting the features and checking the field names and value. Code can be seen at SchematizationTest.
  • In the coming weeks I'll try to implement different constraints over the now simplified network starting with the direction/angular constraint.
Week 6
  • Discussed the ways to implement angle constraint for our project with the mentors.
  • Working on different approaches and will try to figure out which one would be better suited for the project.
Week 7 and 8
  • Implemented the algorithm for the approach of putting angle constraints for lines as was discussed with the mentors earlier. The approach does what was expected and is giving desired results in most cases but still there are some parts where the change in angle is resulting in topological inaccuracies.
  • Will discuss with the mentors ways to handle the inaccuracies.
Week 9
  • After discussion it was decided that we'll try to put in checking mechanisms for the kind of errors/inaccuracies being encountered.
  • Also handled some issues with the algorithm implemented.
  • Will try to finish the implementation of this checking mechanism in the coming week.
Week 10
  • Finished the implementation of checking mechanism to handle the inaccuracies.
  • Will be updating the code in the plug-in. As of now it is the form of scripts.
  • Will discuss with the mentor regarding any issues with the current progress.
Week 11
  • Solved some major bugs after discussing with the mentors and now the results are better than before.
  • In the process of updating the code from the script to the plug-in.
  • For the coming week, will do testing on various datasets. Also, will be working on refining and cleaning the code.
  • Below are the images of the original input layer, the layer after simplification and the output after applying angle constraints.

Screenshot of the input layer Simplified input layer After applying angle constraint

Week 12
  • Successfully updated the plug-in with the angle constraint algorithm.
  • Will work on final documentation and report drafting.
Week 13
  • Documentation Completed.
  • Draft of the project report submitted to the mentor for final evaluation.

streets.rar - OSM dataset cleaned (32.3 kB) Nishith Maheshwari, 05/20/2014 08:00 am

input.png - Screenshot of the input layer (32.2 kB) Nishith Maheshwari, 08/07/2014 09:03 am

simplified.png - Simplified input layer (25.3 kB) Nishith Maheshwari, 08/07/2014 09:03 am

output.png - After applying angle constraint (17.7 kB) Nishith Maheshwari, 08/07/2014 09:04 am