Sunday 25 October 2015

qgis - Quickly browsing of features for the active vector layer?


I often need to view on the canvas the (selected or not) features from the current active vector layer.


In this situation, I only need to view something on the canvas, without doing anything on the canvas itself (so, the active window is always the Attribute Table).



This is what I usually do:



  1. Open the Attribute Table for the current active layer;

  2. Select the first feature;

  3. Press Ctrl+P button (i.e. the "Pan map to the selected row" button);

  4. Minimize the Attribute Table;

  5. View something on the canvas for the current feature;

  6. Go to the first step until needed.


Is there a way (a method, a shortcut) for directly browsing every feature on the canvas without the needing of going backwards and forwards with the Attribute Table? I mean, something like a "next" button?



(I may use the workaround of splitting the windows of the Attribute Table and of the canvas within the monitor, or also docking the Atrribute Table, but I would like to work on the full QGIS window).




EDIT I saw that my question was casted as a duplicate of this question. The two questions are very similiar, but I think it should be left as open for two reasons:



  1. the related duplicated question doesn't have an accepted answer;

  2. my question is slightly different because I'm looking for the possibility of displaying only the selected features (and the @Joseph's answer, that I marked as accepted, answers well to my request).



Answer



One method is to download the selenext plugin from the menubar:


Plugins > Manage and Install Plugins...


Once download, modify the selenext.py file by replacing the following in both the run() and runPrevious() functions:


box = vlayer.boundingBoxOfSelected()
self.iface.mapCanvas().setExtent(box)
self.iface.mapCanvas().refresh()

with:


self.iface.actionPanToSelected().trigger()

Reload the plugin. Now whenever you click on the the next or previous icons, the canvas will pan to the selected feature:



selenext icons


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...