I have shapefile with polylines representing a road network. Under the attribute table, there is a column called highway which specifies which each feature belongs to. i.e primary, secondary,tertiary etc. I want to delete all the polylines in the shapefile except the polylines belong to the "primary" category. Any ideas on how to do this?

  • Deleting a large number of features is much slower than selecting the features you want to keep, and writing those to a new dataset.
    – Vince
    Sep 3, 2019 at 14:12

3 Answers 3


Simply use Select by Expression in the attribute table and write the following expression:

"FieldName" = 'primary' 

Where FieldName is the name of the field in your attribute table. Then use Export Selected Features as from Right-click of the RoadNetwork layer Export -> Export Selected Features As to create a new shapefile with only primary road.

This is much better than deleting the other roads of the existing shapefile.


The easiest way : you open the attribute table, choose your "sort attribute", click on the colum header to sort your features and manually (or using an expression) select all your "primary" category, you then invert the selection and delete them ...


Open the attribute table, choose select by expression (yellow square with an "E"), enter the following


Obviously "columnname" has to be replaced by the name of the column which contains "primary, secondary, tertiary". Then this will select everything which is not a primary road.

Then turn on editing and delete all the features you do not need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.