qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.04k stars 2.92k forks source link

[OAPIF] Adding layer with lot of vertices freezes QGIS #56059

Open Joonalai opened 5 months ago

Joonalai commented 5 months ago

What is the bug or the crash?

When adding layer with lot of vertices from OAPIF provider, QGIS freezes for multiple seconds. If the same layer is added as a GeoJSON layer by downloading the same data from items endpoint, QGIS performs just fine.

Steps to reproduce the issue

To reproduce the bug here is test_data.zip containing docker-compose.yml, pygeoapi configuration file and sample data as GeoJSON.

  1. Download and extract test_data.zip
  2. docker-compose up -d
  3. Add following Oapif server connection: "http://localhost:5000/"
  4. Add Region layer to the project QGIS freezes for at least 10 seconds depending on the machine

Versions

QGIS version | 3.34.3-Prizren | QGIS code branch | Release 3.34 -- | -- | -- | -- Qt version | 5.15.12 Python version | 3.11.6 Compiled against GDAL/OGR | 3.8.2 | Running against GDAL/OGR | 3.8.3 PROJ version | 9.3.1 EPSG Registry database version | v10.098 (2023-11-24) GEOS version | 3.12.0-CAPI-1.18.0 SQLite version | 3.45.0 PDAL version | 2.6.2 PostgreSQL client version | 16.1 SpatiaLite version | 5.1.0 QWT version | 6.2.0 QScintilla2 version | 2.14.1 OS version | EndeavourOS   |   |   |   Active Python plugins db_manager | 0.1.20 processing | 2.12.99 grassprovider | 2.12.99 QGIS version 3.34.3-Prizren QGIS code branch [Release 3.34](https://github.com/qgis/QGIS/tree/release-3_34) Qt version 5.15.12 Python version 3.11.6 Compiled against GDAL/OGR 3.8.2 Running against GDAL/OGR 3.8.3 PROJ version 9.3.1 EPSG Registry database version v10.098 (2023-11-24) GEOS version 3.12.0-CAPI-1.18.0 SQLite version 3.45.0 PDAL version 2.6.2 PostgreSQL client version 16.1 SpatiaLite version 5.1.0 QWT version 6.2.0 QScintilla2 version 2.14.1 OS version EndeavourOS Active Python plugins db_manager 0.1.20 processing 2.12.99 grassprovider 2.12.99

Supported QGIS version

New profile

Additional context

No response

rouault commented 5 months ago

Some performance improvements in https://github.com/qgis/QGIS/pull/56066, but nothing spectacular. The main issue is that we do a double parsing of the /items request response, once with OGR to extract the features, and another one in QGIS itself to customize "id" processing and extracting "links", but that's nothing easy to improve.

Joonalai commented 5 months ago

That's a shame. I tested with your improvements and unfortunately it didn't make much of a difference with my test data.

rouault commented 5 months ago

I tested with your improvements and unfortunately it didn't make much of a difference with my test data.

do you use a debug or a release bug ?

Joonalai commented 5 months ago

I used debug, I'll check also with release containing optimizations tomorrow.

Joonalai commented 5 months ago

With release binary the freezing time was about 18 seconds. The layer appeared in TOC rather quickly, but after that the freezing continued.