qgis / QGIS-Enhancement-Proposals

QEP's (QGIS Enhancement Proposals) are used in the process of creating and discussing new enhancements for QGIS
116 stars 37 forks source link

QGIS Enhancement Proposal: Paged Fetching of Features and Browser Attribute Table Improvements #293

Open nirvn opened 3 months ago

nirvn commented 3 months ago

QGIS Enhancement: QGIS Enhancement Proposal: Paged Fetching of Features and Browser Attribute Table Improvements

Date 2024/03/14

Author Mathieu Pellerin (@nirvn), Matthias Kuhn (@m-kuhn)

Contact mathieu@opengis.ch

Version QGIS 3.X

Introduction

The attribute table of QGIS has long been earmarked for significant enhancements to improve performance and usability, especially when dealing with large datasets. A key feature under consideration is the introduction of pagination, which allows users to navigate through data in manageable chunks rather than loading extensive datasets all at once resulting in poor UX. The complete redesign of the main attribute table is a major project. It requires starting from the beginning and will be tackled in the future. The browser’s attribute table allows previewing the attributes of a dataset before loading a layer.

Current Limitations

The proposal will focus on adding paging support through improving one user-end limitation: currently, the browser's attribute table preview caps the number of rows displayed to the first 100 entries. This limitation can hinder the ability to efficiently browse and preview large datasets, as users cannot easily access records beyond this initial subset without resorting to custom queries or loading full datasets through the main vector layer attribute table, potentially impacting performance.

Screenshot from 2024-03-20 18-15-38

Proposed Solution

This QEP proposes a phased approach to address the attribute table limitation described in the introduction by adding the necessary pagination capabilities within QGIS’ vector data provider and feature request classes, and exposing those new capabilities through the browser panel details’ attributes widget. The goal is to enable users to navigate through large datasets using paging functionalities exposed through a simple UI. This initial scope will lay the groundwork for more extensive attribute table improvements in the future.

Deliverables

  1. Data Provider Pagination Capabilities: Data providers within QGIS will be extended to expose pagination capabilities. Providers can indicate support for no pagination, or offset-based pagination. The architecture will keep in mind the need for a cursor-based pagination in the future. This proposal will primarily focus on introducing offset-based pagination for the postgis provider, but recognizes the need to extent in the future to other interesting formats such as OAPIF (OGC API - Features).
  2. Paginated Feature Requests: When building feature requests, the QgsFeatureRequest class will gain new properties - such as offset or startFromCursor- to complement existing parameters like limit and orderBy. This enhancement will allow efficient data retrieval in a paginated fashion. Consideration will be given to developing a high-level QgsPagedFeatureIterator within the QgsVectorLayer class. This interface would simplify pagination by enabling methods such as QList page = pagedIterator.nextPage(), facilitating straightforward navigation through paged data.
  3. Paginated Controls for the Browser Panel Attributes Tab: The browser attribute table interface will be updated to include pagination controls, allowing users to navigate between pages of data when the data provider supports the new capability. This UI improvement will enhance data accessibility and improve the overall user experience when exploring large datasets within the browser preview. It also aligns with the ongoing efforts to retire DB Manager by implementing its functionalities into QGIS itself.

Risks

Relatively as the introduced API will be used only in the browser panel to begin with.

Conclusion

By introducing paged loading capabilities to the browser's attribute table preview, this QEP aims to significantly improve the user experience in previewing large datasets within the QGIS browser. This initiative also represents a critical foundational stone towards a more comprehensive overhaul of the main vector layer attribute table functionality, with a focus on performance, usability, and modern data management practices. Further discussions and technical explorations will refine the approach to ensure the successful implementation of this enhancement.

The improvements done to the browser panel’s attribute table also supports ongoing efforts to render the DB Manager plugin obsolete by incorporating its functionalities into QGIS itself.

gioman commented 3 months ago

Anything that can improve the current situation is very welcome!

nyalldawson commented 3 months ago

@nirvn

While I'm positive to the described improvements, I have a couple of concerns here:

Now, on to the technical stuff:

Again, I'm keen to see improvements like this, but I just want you to be aware of the full depth of this work before committing to it!