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.14k stars 2.93k forks source link

Virtual layer inconsistency between .exe and .msi installers when not using "autodetect" for the geometry type #44875

Open sigeal opened 2 years ago

sigeal commented 2 years ago

What is the bug or the crash?

With QGIS 3.16.10 installed from msi installer trying to create a virtual layer from a WFS layer, I get this message when testing its validity : qgis_msi

As a result, I can't specify the geometry column name, type and crs.

The same works nice with QGIS 3.16.10 installed from exe installer : qgis_exe

Steps to reproduce the issue

  1. Add a WFS layer
  2. Go to Layer -> Create a layer -> Create a virtual layer
  3. Import the WFS layer
  4. Type a simple query like SELECT * FROM wfs_layer
  5. Specify the geometry column name, type and crs
  6. Click on Test button

Versions

MSI version : qgis_msi_about EXE version : qgis_exe_about

Supported QGIS version

New profile

Additional context

No response

gioman commented 2 years ago

@sigeal works fine here on 3.20.2 msi, can you try with it?

sigeal commented 2 years ago

@gioman Just tested and still same problem on QGIS 3.20.2 Can the problem be related to the fact that my QGIS Server is not set up with SSL ?

sigeal commented 2 years ago

I did some tests from database manager (virtual layers) : image

-Query three displays "geo_text" column : image

I can send the WFS url by private mail for further test.

sigeal commented 2 years ago

I tried again with a public SSL WFS url : https://wxs.ign.fr/beta/geoportail/wfs ... and I got the same symptoms : "Cannot find the specified geometry field!"

agiudiceandrea commented 2 years ago

I can confirm that the issue with WFS at https://wxs.ign.fr/beta/geoportail/wfs occurs using QGIS 3.16.10 and QGIS 3.20.2 from the new (v2/MSI) OSGeo4W installers, while the issue doesn't occur using QGIS 3.16.10 from the old (v1/EXE) OSGeo4W installers.

The issue doesn't occur if the Geometry option is set to "Autodetect".

sigeal commented 2 years ago

@agiudiceandrea : I confirm the issue doesn't occur if the Geometry option is set to "Autodetect", which is not an option for me because with the query I use the geometry type is not correctly recognised (line instead of point) : WITH axe AS (SELECT ST_GeomFromText('LINESTRINGM(500000.0 6700000.0 0, 810000.0 6700000.0 310)', 2154) g) SELECT *, '-10' decal, ST_Line_Interpolate_Point(axe.g, pk / 310) geom FROM axe, inf_dvl I might open another issue for this issue.

sigeal commented 2 years ago

Trying to narrow down the problem, I discovered that it also happens with simple queries like : SELECT SetSRID(ST_Point(520000, 6700000), 2154) geom or : SELECT ST_GeomFromText('POINT(520000 6700000)', 2154) geom

In each case, I don't get the geom column in the DB Manager result display, but I can though load the result in QGIS canvas. However, if I edit the resulting virtual layer to change the geometry type from "autodetect" to manual specification (geom, Point, 2154), I get the error message "Cannot find the specified geometry field!".