0

I have used a shapefile I've downloaded from ONS for the UK's local authorities. However, I am only interested in certain local authorities in England and want to blank out Scotland and Wales.

How can I do this?

enter image description here

  • Nothing yet, because I'm completely new and have no idea where to start. – Jimbob Jones Mar 7 at 11:13
  • Take an intro to editing in QGIS - in outline: enable edit mode (pencil button) select bits of Scotland (highlight tools) delete bits (Ctrl-X) disable edit mode (pencil button) and save layer. Now you have a shapefile without Scotland. Plenty of detailed tutorials - check the qgis home page for docs. – Spacedman Mar 7 at 15:00
  • I think I know the dataset you're using but would you just check the following? Load the shapefile and right-click on it in the layers panel. Then click on 'Open Attribute Table.' Is there a field called 'lad17cd' ? – nhopton Mar 8 at 10:25
  • Yes, there is a field called lad17cd – Jimbob Jones Mar 11 at 11:08
1

The objects (polygons) in this ONS Local Authorities dataset do not have a 'Country' attribute. They do however have a 'lad17cd' attribute whose values are eight-digits preceded by a letter, 'E' in the case of English districts.

This means the shapefile can be filtered to include only English districts.

Load the shapefile, right-click on it in the 'layers' panel and select 'Filter..'. Then in the 'Provider specific filter expression' box type (or paste) the following text:

"lad17cd" LIKE 'E%'

and click 'OK'.

This should filter out the Scottish and Welsh polygons leaving just the English ones.

If you want to show the Scottish and Welsh polygons in, say, light grey, load the shapefile again and drag it below the filtered layer in the layers panel, then style it in light grey, or as required.

enter image description here enter image description here

3

If you want to hide completely Wales and Scotland, right-click the layer in the table of content -> Properties -> Source (in QGIS 3.4.5) or General (in 2.18) -> Query Builder, and write the following:

"FieldName" != 'Wales' and "FieldName" != 'Scotland'

Where FieldName is the name that has the names of Wales and Scotland

If you change the color for something else only for Wales and Scotland, then go to Symbology -> select Rules-based and do the following:

  1. Click of plus sign to add a rule
  2. Double click the added rule
  3. Go to expression and write: "Field_Name" in ('Wales' , 'Scotland') and give it the color you want
  4. Repeat steps 1-3, but for step 3 write: else, and give it the color your want

enter image description here

The output should something like this, but sure the maps are different:

enter image description here

enter image description here

  • Thanks, this is helpful. How can I shade Scotland/Wales a different color? Also, I want to focus on certain local authorities in England. How can I make the ones of focus a color and the local authorities I'm not interested in white with no borders? – Jimbob Jones Mar 7 at 11:13
  • I don't find Query Builder. I right clicked the layer table on left-hand side and tried properties from the main menu at the top of the screen. – Jimbob Jones Mar 7 at 11:26
  • It depends on the QGIS version. In QGIS 3.4.5, it located under Source tab at the bottom right corner, in QGIS 2.18, it is located under General tab. If the data is raster data, there is no Build Query – ahmadhanb Mar 7 at 11:34
  • Ah it must be raster data as I'm unable to access the Query Builder, the button is faded slightly and cannot click it. – Jimbob Jones Mar 7 at 12:11
  • You definitely are working with vector data, not raster data. The query builder can be unavailable for other reasons. Is your layer in edit mode? You can't apply a filter to a layer in edit mode. – csk Mar 7 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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