I have a spatialite point table (p1) with an additonal column (pid) that relates each point to a point in another point table (p0) in the same database. I want to create a line between every pair of points where p1.pid matches p0.id. This is a 1:1 relation.

How can I do that in spatialite or in QGIS 2.14?


A solution was actually buried in this answer, which I could modify for my problem:

SELECT MakeLine(p0.geom, p1.geometry) AS link_line FROM "buildings_p0" p0, "roadpoints_p1" p1 WHERE p1.pid = p0.id;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.