Saturday, 13 October 2018

qgis - Zoom to feature by clicking cell in the Attribute Table


I have a layer which has FID field representing the unique ID of features. In QGIS, there is a Zoom to selected rows button on top of the Attribute Table. It has a shortcut (Ctrl + J) and it doesn't work (at least in my computer). (In ArcGIS, when you double-click a row number in the Attribute table, it zooms to related feature)


Sometimes, it's a waste of time to click the zoom button if considering hundreds of features and I need to speed up the zooming process to save time.


I can display the attribute table using the lines below and get the reference of it.


lyr = QgsProject.instance().mapLayersByName("LAYER_NAME")[0]

attr_table = iface.showAttributeTable(lyr)

Is there any programmatic way to zoom to a feature by clicking FID cell in the Attribute Table in QGIS? How can I add this capability to the Attribute Table?




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...