Hi Simon,
One way would be to add the line layer as a virtual layer with the query text:

SELECT make_line(A.geometry,B.geometry) AS geom, 
st_distance(A.geometry,B.geometry) AS dist
FROM LayerA AS A, LayerB AS B

Just substitute LayerA and LayerB with the names of your layers.

This would create a dynamic layer with one attribute "dist" - the distance 
between the points, and the geometry would be a line connecting the two points. 
 Whenever you move a point the line layer will update, if you labelled the line 
layer with the distance attribute, the label position and text would also 
update.

It gets quite funky if you have multiple points in each layer - there are lines 
drawn between all points.  If there are m points in layer A and n points in 
layer B there will be m*n points in the dynamic layer (a "cross join" in SQL 
parlance).  I imagine performance would be dreadful on layers with many points 
- but not an issue for your use case.

Cheers,
Martin.

-----Original Message-----
From: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of simonc8
Sent: Friday, 13 October 2017 3:22 AM
To: qgis-user@lists.osgeo.org
Subject: [Qgis-user] Linking coordinates between layers

I have two point layers each with a single point in them. I want to draw a line 
joining the points to use to measure the distance apart. I have found various 
plug-ins which allow this, but is there a way I can actually link the point 
coordinates to the line layer so that if I move one of the points the line will 
update automatically?

Grateful for advice.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

This email is intended for the named recipient only.  The information it 
contains may be confidential.  If you are not the intended recipient you must 
not reproduce or distribute any part of this email, disclose its contents to 
any other party or take any action in reliance on it.  If you have received 
this email in error, please contact the sender immediately and delete the 
message.
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to