3liz / lizmap-plugin

Lizmap plugin for QGIS, allowing to publish QGIS maps to Lizmap Web Client
https://www.lizmap.com/
GNU General Public License v2.0
63 stars 31 forks source link

[Bug]: Saved extent is not valid in CFG #571

Closed tbnobody closed 6 months ago

tbnobody commented 8 months ago

What is the bug?

I just saved a new configuration of a project and the project failed to parse:

2024-03-13 16:16:19     10.140.129.6    [0]     The file /opt/qgis/lizmap/projects/ProjectOverview.qgs.cfg cannot be decoded.    /var/www/lizmap-web-client-3.7.5/lizmap/modules/lizmap/lib/Project/Project.php     135
        /lizmap/admin.php/admin/qgis_projects
array (   'module' => 'admin',   'action' => 'qgis_projects:index', )

        0       Lizmap\Project\Project->__construct()   /var/www/lizmap-web-client-3.7.5/lizmap/modules/lizmap/lib/Project/Repository.php : 294
        1       Lizmap\Project\Repository->getProject() /var/www/lizmap-web-client-3.7.5/lizmap/modules/lizmap/lib/Project/Repository.php : 388
        2       Lizmap\Project\Repository->getProjectsMetadata()        /var/www/lizmap-web-client-3.7.5/lizmap/modules/lizmap/classes/lizmapRepository.class.php : 166
        3       lizmapRepository->getProjectsMetadata() /var/www/lizmap-web-client-3.7.5/lizmap/modules/admin/zones/project_list.zone.php : 43
        4       project_listZone->_prepareTpl() /var/www/lizmap-web-client-3.7.5/lizmap/vendor/jelix/jelix/lib/jelix/utils/jZone.class.php : 282
        5       jZone->_createContent() /var/www/lizmap-web-client-3.7.5/lizmap/vendor/jelix/jelix/lib/jelix/utils/jZone.class.php : 217
        6       jZone->getContent()     /var/www/lizmap-web-client-3.7.5/lizmap/vendor/jelix/jelix/lib/jelix/utils/jZone.class.php : 373
        7       jZone::_callZone()      /var/www/lizmap-web-client-3.7.5/lizmap/vendor/jelix/jelix/lib/jelix/utils/jZone.class.php : 114
        8       jZone::get()    /var/www/lizmap-web-client-3.7.5/lizmap/modules/admin/controllers/qgis_projects.classic.php : 31
        9       qgis_projectsCtrl->index()      /var/www/lizmap-web-client-3.7.5/lizmap/vendor/jelix/jelix/lib/jelix/core/jCoordinator.class.php : 266
        10      jCoordinator->process() /var/www/lizmap-web-client-3.7.5/lizmap/www/admin.php : 23

For some layers I see the following in the json code:

        "Offices": {
            "id": "Offices_3e456444_b7b3_4ed5_b24e_f67e35c952d4",
            "name": "Offices",
            "type": "layer",
            "geometryType": "point",
            "extent": [
                NaN,
                NaN,
                NaN,
                NaN
            ],
            "crs": "EPSG:4326",
            "title": "Offices",
            "abstract": "",
            "link": "",
            "minScale": 1,
            "maxScale": 1000000000000,
            "toggled": "False",
            "popup": "True",
            "popupSource": "form",
            "popupTemplate": "",
            "popupMaxFeatures": 10,
            "popupDisplayChildren": "False",
            "popup_allow_download": true,
            "legend_image_option": "hide_at_startup",
            "groupAsLayer": "False",
            "baseLayer": "False",
            "displayInLegend": "True",
            "group_visibility": [],
            "singleTile": "True",
            "imageFormat": "image/png",
            "cached": "False",
            "clientCacheExpiration": 300
        },

The NAN is invalid.

Versions, safeguards, checks summary etc

Versions :

List of safeguards :
* Mode : safe * Allow parent folder : no * Prevent other drive : yes * Prevent PG service : yes * Prevent PG Auth DB : yes * Force PG user&pass : yes * Prevent ECW : yes

Check Lizmap plugin

tbnobody commented 8 months ago

Don't know where the error came from but after pressing this button for all affected layers it's working now: grafik

Gustry commented 8 months ago

Where are these buttons ? Is it in the vector layer properties then datasource, right ? you mean the button on the right ? Sorry I don't speak german.

I'm QGIS updated the project extent, your project was newly created right ?

tbnobody commented 8 months ago

Sorry, I didn't have a english qgis version available. But right, Layer Properties, Datasource grafik

The layer is a PostGIS layer. It was a project which was used before. Also the .cfg was generated previously without any error. Not sure if it's a problem of QGIS or the extension. But it happend just now again. I had to press the button again.

tbnobody commented 8 months ago

Ok just figured it out....

Gustry commented 8 months ago

go to lizmap extension, press "Save" Correct coordinates in json go to lizmap extension, press "Save" NaN in json

Do you mean you press twice ? Because there isn't any user action in between these two.

What kind of layer is Offices ? PH, SHP, GPKG ? Is-it possible to share it ? I will just add a safeguards for now

Gustry commented 8 months ago

In your vector layer properties → Information tab → Provider, what is the "Extent" here ? The plugin is taking these values.

tbnobody commented 8 months ago

Do you mean you press twice ?

Correct, just closed the extension window and opened it again

What kind of layer is Offices ?

It's PostGIS

In your vector layer properties → Information tab → Provider, what is the "Extent" here ?

You are right, it's shown as Null grafik

Just saw, when pressing the Rebuild button I get the following log output:

2024-03-14T10:48:00     WARNING    Ergebnis der Ausdehnungsabfrage ungültig: BOX(-88.00371551513672 -33.86600112915039,151.2113037109375 52.9696044921875)

Translated: Result of the expansion query invalid

Gustry commented 8 months ago

Even QGIS can't get the correct extent of your layer.

Side question can you select the layer in your legend and then Python → Console

iface.activeLayer().extent().isNull()
iface.activeLayer().extent().isEmpty()

And give the output of these two commands ?

tbnobody commented 8 months ago

And give the output of these two commands ?

Both return True

tbnobody commented 8 months ago

Just found this: https://github.com/qgis/QGIS/issues/56541

Gustry commented 6 months ago

It seems it will be fixed upstream.