How to extract multiple features from a shapefile in QGIS

This is a simple(ish) guide to finding and extracting features from a larger map into a smaller one. In this example selected rivers in South Africa are copied into a new GeoJSON format file.

Start with a shapefile and QGIS. This shapefile is of rivers in South Africa and is a good example of selecting multiple portions of a file:

allrivers.zip

Download this or use your own shapefile.

1. Open the file in QGIS

  • Open QGIS and click Project→New to create a new project
  • Drag the zip file into the main QGIS window
  • A popup will appear. You only need the “wriall500.shp” layer in this case, so click that to select it and then OK to open.

The map file will open in the main window and look something like this:

2. Search for the rivers

Right click on the “wriall500” layer in the bottom left pane and then select “Filter”.

On the next screen select the columns to search and the values.

Double click on the buttons, columns and values to add them to the query box at the bottom.

This can take a bit of experimentation but as a starting point, it’s possible to find a number of rivers by using this query:

“NAME” IN (‘Klip’, ‘Vaal’, ‘Sandspruit’, ‘Harringtonspruit’, ‘Natalspruit’)

Add additional river names in single quote marks and separated by commas.

Use the “Test” button to check the results for errors.

Click OK to select these features. This will close the filter window and get you back to the main QGIS window. You may or may not see the features you selected in the main window at this point. Either way, you can export the selected features:

3. Export the river features

Right-click on wriall500 layer and select Export→Save Features as

On the next pop-up screen:

  • Select GeoJSON for the export
  • Add a filename
  • In the “CRS” section you may see “Invalid Projection”. Change this to something like “WGS84”
  • Click OK to export the file.

4. Test in Mapshaper

The easiest way to check the export is to open Mapshaper and drag the newly exported geoJSON file into the main window.

This should show just the rivers selected:

Add a basemap layer to check the river positioning:

5. Export to SVG

In Mapshaper it’s easy to export to SVG which can then be used in Figma or Illustrator to touch up or add details.

6. Final files

The process above produces the following files: