[Qgis-user] Create Geometry for virtual layer

John Stevenson - BGS jostev at bgs.ac.uk
Mon Sep 30 06:32:14 PDT 2024


Try:

select
  avg(_gfsGEO_RECHTSWERT) as x,
  avg(_gfsGEO_HOCHWERT) as y,
  Filename,
  _gfsfid,
  _gfsKURZNAME,
  avg(T_C)
  st_point(x, y) as geom
from Temp_near_GFS
group by Filename, _gfsfid

If that doesn’t work, you may need to replace x, y in the st_point call with the full calculations e.g.

st_point( avg(_gfsGEO_RECHTSWERT), avg(_gfsGEO_HOCHWERT) )

Cheers
John

From: QGIS-User <qgis-user-bounces at lists.osgeo.org> On Behalf Of Roland Spielhofer via QGIS-User
Sent: 30 September 2024 13:45
To: QGIS User <qgis-user at lists.osgeo.org>
Subject: [Qgis-user] Create Geometry for virtual layer

Hi,
I have a query like this

SELECT avg(_gfsGEO_RECHTSWERT) as x, avg(_gfsGEO_HOCHWERT) as y, Filename, _gfsfid, _gfsKURZNAME, avg(T_C) FROM Temp_near_GFS group by Filename, _gfsfid

to average some values accoring to their attributes.
I get a new virtual layer and the attribute table content looks fine, x and y are populated as well with reasonable values.

What I am struggling is to create the actual points / geometries to make the locations visible.
How do I modify the statement so that I can specify a "geometry column" as expected by the Creat/Modify Virtual layer GUI in the bottom of the form?

TIA Roland


This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240930/4d0d30d2/attachment.htm>


More information about the QGIS-User mailing list