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?
3 Answers
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
"COLUMNNAME" NOT LIKE 'primary'
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.