TransWikia.com

Remove a part of line features shapefile using a polygon shapefile in QGIS

Geographic Information Systems Asked by Tharaka Devinda on December 7, 2020

I have a road network map which I need to cut off parts off using a polygon.

Both road network and the polygon are shapefiles. What I need to do is to use the polygon like a cookie cutter and cut off the road parts which fall into the polygon. After the operation is complete, what should be left is the road network which does not belong inside those polygons

So start:

enter image description here

Polygon:

enter image description here

Expected Result:

enter image description here

I tried to do this in QGIS using the Difference, intersection and other features in the Geoprocessing toolbox but they don’t seem to work because I have two types of features. (Lines and Polygon)

I cant convert the road layer to polygon, that would end up in a disastrous mesh of polygons.

Is there a way to do this in QGIS? I am very new to QGIS, so assume a complete dummy.

One Answer

This task can be done using difference. Set the line layer first, the polygon second, then the polygon area will be substracted from the lines and you have your desired result.


A bit of genereal advice: If a tool "does nothing", there are several option. Maybe the tool really doesn't work, maybe your layers are faulty, or maybe the user did something wrong. It happens to everyone, and my first step when this happens to me, is to take a look at the tooltip. For every tool in the GUI there's a rather helpful tooltip to the right of the dialogue. E.g. for difference it says

This algorithm extracts features from the Input layer that don’t fall within the boundaries of the Difference layer. Input Layer Features that are partially within Difference layer feature(s) are split along the boundary of the clip layer feature(s). If any features are selected in the Input and Difference Layers, then only those features are used in the operation. If no features are selected, then the operation is performed using all features.

This states clearly, that areas of the second layer are substracted from the first one. So, if you put your lines as second layer, there's no area which could be substracted from the polygon.

Correct answer by Erik on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP