Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I got shapefile with 1800 points. They are classified by attribute in 10 classes. How can I display only 1 or 2 classes (like - switch on/off layer)?

It seems quite usual function, but I couldnt find such option in QGIS. The only solution witch I could figure out, is to make 10 different shapefiles for each class.


share|improve this question
up vote 4 down vote accepted

You certainly don't need 10 different shapefiles.

You can load the same shapefile 10 times (into 10 different layers) and use the query definition (in Layer Properties - General tab) to define the class. Then you can turn the layers off and on as you like. This takes a little time to set it up but at least it does not clutter your harddrive with million shapefiles.

Another solution would be to use a rule-based renderer where you can adjust the query that defines the classes that are drawn.

enter image description here

share|improve this answer
Thanks for the tip. Although, at the first moment it looks not so handy to move between classes. – Oskars May 19 '12 at 8:18
@Oskars: added another option – underdark May 19 '12 at 9:46
@Oskars Please consider accepting the answer or clarifying if you need more help. – underdark May 20 '12 at 10:49
This solution, while it is the only one that is feasible with current QGIS, is really sub-sub-optimal. I took the liberty to submit a feature request… – steko Feb 22 '13 at 12:10
Correct link to the QGIS feature request by the way it was much appreciated by several QGIS developers :-) – steko Feb 23 '13 at 18:45

Another option is to run a query on the shapefile. You get to the query builder with a right-click on the layer name (in the TOC) and choose Query. Then setup the query such that it reads: [Class_Column] = 'Class'

To display a different class you'll change the query each time.

You can also manipulate the query to display several classes [Class_Column] = 'Class1' OR [Class_Column] = 'Class2' and so on...

Does that get you any closer?

share|improve this answer
Not sure I want to make query each time to turn on/off different clases...:) @underdark first suggested option was helpfull. I open 10 the same shapefiles, but instead of making a query in each shape file, I just delete unnecessary class. So I have 10 separate classes (layers), which I can easily turn on/off. And, as mentioned above, this solution doesnt make tonns of shapefiles, because I can do it within 1 shapefile. Maybe it is not logic or whatever, but at least I understand what I am doing and it is easier to explain it for I am using QGIS in master thesis:) – Oskars May 19 '12 at 17:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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