5

When hovering over a vector layer in QGIS for feature selection, it would be useful, if only those in a buffer of a certain distance to the mouse cursor are displayed. Any ideas on if/how this might be available or quickly realizable?

Here is a visual example: selected points If the green point would be the mouse cursor, I would like to see/highlight the yellow points only.

  • There is the Select Features by Radius option. I think you can once the features are selected, if you entered a unique value for the selected features in the attribute table, you could apply a style so that only the features with the unique value would be shown on the map. However I think you want a floating buffer around your mouse cursor that selects features within that circle? – maskin Sep 12 '18 at 16:00
  • @maskin I was not referring to actually selecting features in a buffer around my mouse cursor, but more to displaying only features in a buffer around my mouse cursor. This would help to avoid being overwhelmed by a large number of points when being zoomed out. The user only has to see the points once zoomed in and once he/she hovers over an area with the mouse. Does that make it clearer? – Sophie Crommelinck Sep 13 '18 at 15:09
  • Yes I think I understood that. I think you are looking to blur/make invisible all the points except a buffer around your mouse cursor. I don't know of a tool that will do that. Work around: as I say try using the select by radius tool to draw circles on the map, and setup a style to only show only the selected features. I guess it is possible to setup a style that should only show the selected features on the QGIS map canvas, but I only know of styling using specific values in the attribute table. – maskin Sep 14 '18 at 12:19
  • 1
    You might have discarded this option for other reasons of course, but if the problem is a large amount of points when zoomed out, why not use scale based visibility on the relevant layer? – hexamon Oct 23 '18 at 12:53
  • 1
    Also have a look at the Point Cluster and Heatmap styles. These styles provide alternative ways of viewing many points on a map. – csk Feb 15 at 19:53
2

I propose a solution under QGIS 3.x :

  1. Go to the point layer properties

  2. Create a categorized renderer(a) or a rule-based renderer(b), with two rules :

    1. a : Value 1, symbol 'yellow point' ;
    2. a : Value 0, no symbol or 'normal point' or 'small dark point' ;
    3. a : expression formula for the column field :

    contains(buffer(@canvas_cursor_point, 123, 30), $geometry)

    1. b rule 1 : contains(buffer(@canvas_cursor_point, 123, 30), $geometry) = 1

    symbol 'yellow point' ;

    1. b rule 2 : contains(buffer(@canvas_cursor_point, 123, 30), $geometry) = 0

    no symbol or 'normal point' or 'small dark point' ;

123 here is the buffer size in the layer units.

  1. Go to the rendering tab and check Refresh layer at interval (seconds) and set time at 0.1 (for test, adjust after).

  2. Return to the map and see the result with hovering your cursor above the layer.

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.