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.
- Pyproj - For handling Coordinate Reference System checks on the data.
- GeoPandas - Interface for importing geopackage to a pandas dataframe for processing.
- Shapely - Handling processing of coordinates in a plane independent of data format.</br></br>
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.
- Running the setup installer displays an installation wizard. The pages of the wizard are as follows: Ensure the “Advanced Install” radio button is checked below. Click Next button to continue.
- For new users, install from the internet by ensuring the selected radio button appears as shown below.
- Install for all users to allow other user accounts to access OSGeo functions. Click Next to continue
- Browse to the preferred download location of the installation files and the selected path shall be shown once selected. For the start menu name, leave as default.
- In this page you can leave as default and click Next.
- I prefer downloading from osgeo repository but one is at liberty to download from either and also add a repository that is not on the list show. Once done, click Next button to continue with lis selection of components..
- From the list under commandline utilities, select the shown Python items. This will install Python core items which are important in our project.
- From the list search for GeoPandas which is also a requirement for this project.
- Select Python Index Package which can come in handy in upgrading and installing other packages independent of this project.
- Select Shapely and Pyproj packages which are important for this project.
- Select PyQt5 for GUI development and customization if one needs to re-design UI layout or create custom UI widgets.
- Finally, ensure that QGIS Desktop is selected. I prefer using the Long Term Release (LTR) for it is most stable. After all that click Next button to continue
- After successful installation, download the plugin from this repository or use Git to clone the plugin in the
QGIS Desktop Plugins folder which can be accessed at
%APPDATA%is a Windows variable for
C:\Users\<Account User>\AppData\Roaming\and could be hidden in mose
Using the Plugin
- Open QGIS Desktop from the shortcut on Desktop or from Start Menu. For the Start Menu, she shortcuts should appead as shown below.
Alternatively, one can run it from OSGeo4W shell. Please refer to the commandline options from OSGeo4W
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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