I tried to use solution posted here, but ST_Distance in the Virtual Layer query doesn't work properly in Qgis (v3.2) on Mac, the result is showing blank while the same script is working properly in QGIS (v3.4) on Windows.
Here is my test script for virtual layer:
WITH distances AS(
SELECT
s.id site_id,
a.Mem_ID mem_id,
ST_Distance(
s.geometry,
a.geometry
) dist
FROM site_a27 s
CROSS JOIN A27_re a
)
SELECT * FROM distances
table for site_a27:
id,name,Response_X,Response_Y
1A27,bade,121.301412,24.968988
table for A27_re:
Mem_ID,Response_X,Response_Y
19960126000178,121.312175,24.987227
19960129000943,121.302705,24.978186
19960131001647,121.303628,24.957379
19960131002543,121.300855,24.984292
19960203000247,121.296974,24.968484
output of virtual layer on Mac:
output of virtual layer on Windows:
Information about my QGIS version on Mac:
How do I solve this in QGIS on Mac?
True
for the use_ellipsoid parameter. Without that parameter: "return the distance between geom1 and geom2 (always measured in CRS units)". But I agree with the check of the layers CRS.SELECT 1 fid, ST_Distance(GeomFromText('POINT(0 0)'),GeomFromText('POINT(1 1)')) dist;
. Does it return a distance in the table?