Not sure if this option ever existed, but the new QGIS version hides a lot of things somewhere else and this seems so simple that I'm kind of convinced it was possible to do this before.

I have quite a large data set with ship tracks. I now want to analyse individual ship tracks (made from point layer with points2one) - however, it is so crowded that it is hard to look at individual tracks. I don't want to save each single track as a new layer, so I wonder if it is possible to select one track in the attribute table and display only that one on the map/hide the others?


Kadeem's answer will prevent your features from being visible, but they will still be present, if you are trying to identify an individual ship track you may click an invisible feature by mistake. What it seems like you need to do is define your layer so that it's as if those features don't exist. In ArcGIS this would usually be done using a Definition Query, in QGIS the equivalent command is the Layer Subset. Go to the Properties of your layer, under the General tab, at the bottom is the Feature Subset box, click the button below it to bring up the Query Builder:

enter image description here

The Query Builder will help you create an SQL query to define what features in your layer should actually be displayed in your project. Any features not returned by the query are made invisible, not just visually but entirely (they are not deleted from your data, of course, they're just defined out of existence until you remove the Layer Subset query).

  • Dan, thanks a lot!!! This is what I was looking for, a bit more complicated than I hoped but does the trick! Very helpful, thanks! – Kristina Aug 27 '14 at 16:26
  • That's idd the answer. Nice tip Dan! – kadéem Aug 28 '14 at 14:05
  • Weird. Some time ago I did this and it worked. Now I want to do it again on another layer and the Feature Subset box is grayed out, as well as the button of the QueryBuilder! Any suggestion??? – Patrick Van Den Noortgaete May 12 '15 at 6:51
  • Solved, but not clear why. I saved the changes I made and then the QueryBuilder Button became available... – Patrick Van Den Noortgaete May 12 '15 at 6:58
  • 1
    @SimoA. If your data is in Excel, you could filter it there, add a new field where you convert VALUE to 'VALUE',, then copy and paste that field into the query box using an IN query. – Dan C Oct 11 '16 at 19:47

Kristina, I assume there is an attribute in your table which allows you to identify a single track? For example:

  point_id  |  track_id
     1      |     15
     2      |     15
     5      |     24
     6      |     24
     7      |     24

If you open the attribute table, you can find an epsilon symbol (in the figure below, the 4th one).

enter image description here

This allows you to type an expression; for example:

"track_id" = 24

When you confirm, all rows that satisfy your expression (that is: all points that belong to the track with track_id X) are selected. If you then click on the magnifier button, QGIS zooms to your selection in the map canvas. The selected features (points in your case) are highlighted.

What you can do is to apply a rule-based style. As such you can show an individual ship track using a given symbol or marker, and 'not show' all other points by giving them an 'unvisible' marker. The screenshot (part from Layer Properties) below explains how it works:

  • Rule 1: apply the given marker to all points having a value of 24 for track_id
  • Rule 2: apply the given marker (a circle with white fill and white border...) to all points that do not satisfy a track_id value of 24

enter image description here

In fact all points are still there (making them white will not make the rendering taking less time) but at least your eyes can relax!

  • Thanks a lot for your answer Kadeem! I am aware of the selection function and this works well, however, I literally have 500,000 points in a small area and just highlighting the tracks I am looking for is not enough, the map is still too crowded and confusing. Do you know if there is a possibility to block all not selected points or something like it? – Kristina Aug 27 '14 at 14:05
  • 2
    I edited my answer with another option below the line. I guess this will help you. – kadéem Aug 27 '14 at 15:53
  • Kadeem, this is so simple but effective - great idea, thanks so much! – Kristina Aug 27 '14 at 15:58

This is now possible using just selections and a rule-based symbology.

This requires the Expression Plus plugin (for QGIS 2.x. 3.0 has the functionality built in).

Create a rule based symbology with the filter of:

QGIS 3.0+ (from thequerist in the comments):


QGIS 2.12-2.18:

isselected( @layer_name )

Or QGIS 2.8:

isselected( 'ACTUAL_NAME_OF_LAYER' )

Now only the selected features that meet this rule will be shown.

You can also have an ELSE rule for all unselected features.

enter image description here

  • 1
    This is exactly what I was looking for - thanks for this answer – geobar Oct 13 '16 at 14:01
  • HeikkiVesanto, where i insert this filter? – newGIS Aug 23 '17 at 20:06
  • I have added a picture. – HeikkiVesanto Aug 24 '17 at 8:32
  • 1
    Using QGIS 2.18.14 and the expression that worked is isselected('layer_name'). Using (@layer_name) returned 0 results. – Techie_Gus Dec 18 '17 at 16:47
  • 2
    In QGIS 3 and above this feature is built in. You can find it under Record and Attributes in the Expression String Builder. Also, you do not need to put the layer name in anymore and do not forget to underscore between is and selected. Here is an example for QGIS 3 and above: is_selected(). – thequerist Oct 2 '18 at 19:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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