Polygon spike remover plugin for QGIS Desktop.

View on GitHub

Polygon Spike Remover

This is a QGIS Desktop plugin that reads data in particular polygons from an OGC GeoPackage file residing in the computer’s file system and loads it in the QGIS Map View. It also checks if the loaded polygon contains spikes and if it contains, removes them and saves the output in a new GeoPackage file without altering the original.


To install this plugin, one requires QGIS Desktop, an Open Source Desktop GIS software, Python with pip installed in the computer. Other external dependencies include

  1. Pyproj - For handling Coordinate Reference System checks on the data.
  2. GeoPandas - Interface for importing geopackage to a pandas dataframe for processing.
  3. Shapely - Handling processing of coordinates in a plane independent of data format.</br></br>

    On Windows

    To install the requirements (tested on Windows 10 OS):

    • Navigate to QGIS download website and download OSGeo4W network installer which provides more options for downloading of package dependencies and libraries as opposed to the usual installer. The network installer appears in the file as shown below.


Alternatively, one can run it from OSGeo4W shell. Please refer to the commandline options from OSGeo4W

  1. After the QGIS Desktop has loaded, the toolbar should contain a shortcut for the Polygon Spike Remover plugin as shown below.

and the menu also appears under Vector Menu in the QGIS Menu Bar as shown below.

  1. To see the plugins details, click the QGIS Plugin Menu and under that click Manage and Install Plugins… whcih will try to connect to the QGIS Plugin Repository and then show the list of plugins. In the search bar at the top, type ‘Polygon Spike Remover’ and it shall show the plugin and click on it to show more information as shown below.

  1. When one clicks the plugin shortcut, it launches a docked widget user interface containing three buttons with icons and text as shown below. Note that the second and last buttons are disabled by default.

  1. On clicking “Open GeoPackage” button, a file dialog is opened and displays the file system. One can use it to navigate to the location of the geopackage with spikes. The file dialog appears as shown below.


  1. After selecting the geopackage, it is displayed in the QGIS map view area as shown below and the second and third buttons are now enabled since there is a layer that has been loaded.


  1. To check the polygon for spikes, click “Remove Spike(s)” button and it initiates a process to remove spikes on the layer. And displays the geometrically corrected layer in the map view in addition to the previous layer as shown below. Also note the button has been disabled after the process is complete.


  1. Finally, to remove all the layers in the map view, click the “Clear map view” button. Once layers are cleared, the state returns to how it was previously.


The above procedures summarize the working of the plugin. In the event of any issues or enhancements, please create an issue or a pull request.

Support or Contact

Email: contact@josephkariuki.com