Connect Points using line different table in QGIS3Error 000725 using Points to LineZ values in kmlLooking for an algorithm to quickly find the closest point on a road network (or other graph)Creating curved lines between two points in QGISHow to connect points to only nearby pointsGroup geotagged photos in MapInfoConnect points and store point info in line attributesCreating points projected on line using QGIS?QGIS points or line vertexCreating line from points in QGIS
Can the Help action be used to give advantage to a specific ally's attack (rather than just the next ally who attacks the target)?
Question about exercise 11.5 in TeXbook
How feasible is the Delta-Glider?
Why does the UK have more political parties than the US?
The Passive Wisdom (Perception) score of my character on D&D Beyond seems too high
Do firearms count as ranged weapons?
Could IPv6 make NAT / port numbers redundant?
How to prevent bad sectors?
1960s sci-fi novella with a character who is treated as invisible by being ignored
How do I subvert the tropes of a train heist?
What are these (utility?) boxes at the side of the house?
Could I be denied entry into Ireland due to medical and police situations during a previous UK visit?
Modern approach to radio buttons
What does it mean when you think without speaking?
Windows 10 Programs start without visual Interface
How were these pictures of spacecraft wind tunnel testing taken?
Why does the 6502 have the BIT instruction?
Future enhancements for the finite element method
Why do Russians call their women expensive ("дорогая")?
What F1 in name of seeds/varieties means?
Can't use numexpr in horizontal mode
What are the problems in teaching guitar via Skype?
What's the connection between "kicking a pigeon" and "how a bill becomes a law"?
The qvolume of an integer
Connect Points using line different table in QGIS3
Error 000725 using Points to LineZ values in kmlLooking for an algorithm to quickly find the closest point on a road network (or other graph)Creating curved lines between two points in QGISHow to connect points to only nearby pointsGroup geotagged photos in MapInfoConnect points and store point info in line attributesCreating points projected on line using QGIS?QGIS points or line vertexCreating line from points in QGIS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have two tables.
Table1 is having many point objects (Sample given below)
Table2 shows the connectivity between the point object(using a link) and link details
My requirement is to have a new Line layer connecting point objects from Table1 as per the Link in Table2.
example : I need to have one line connecting A1 to A3 with a name of "A1_A3", another Line connecting A5 to A4 name of the line to be A5_A4)
I tried with few plugins like connectpoints & points2one... But no luck.
qgis points-to-line
New contributor
add a comment |
I have two tables.
Table1 is having many point objects (Sample given below)
Table2 shows the connectivity between the point object(using a link) and link details
My requirement is to have a new Line layer connecting point objects from Table1 as per the Link in Table2.
example : I need to have one line connecting A1 to A3 with a name of "A1_A3", another Line connecting A5 to A4 name of the line to be A5_A4)
I tried with few plugins like connectpoints & points2one... But no luck.
qgis points-to-line
New contributor
@GIS_Esri: Do you want cross join? or not? describe more plz.
– Taras
May 22 at 9:14
Have you had a look atconnect by lines
(search forconnect
in the tool box)? Feature names may be added afterwards using the field calculator. Could this suit your needs?
– Erik
May 22 at 9:25
add a comment |
I have two tables.
Table1 is having many point objects (Sample given below)
Table2 shows the connectivity between the point object(using a link) and link details
My requirement is to have a new Line layer connecting point objects from Table1 as per the Link in Table2.
example : I need to have one line connecting A1 to A3 with a name of "A1_A3", another Line connecting A5 to A4 name of the line to be A5_A4)
I tried with few plugins like connectpoints & points2one... But no luck.
qgis points-to-line
New contributor
I have two tables.
Table1 is having many point objects (Sample given below)
Table2 shows the connectivity between the point object(using a link) and link details
My requirement is to have a new Line layer connecting point objects from Table1 as per the Link in Table2.
example : I need to have one line connecting A1 to A3 with a name of "A1_A3", another Line connecting A5 to A4 name of the line to be A5_A4)
I tried with few plugins like connectpoints & points2one... But no luck.
qgis points-to-line
qgis points-to-line
New contributor
New contributor
edited May 22 at 9:07
J. Monticolo
2,153522
2,153522
New contributor
asked May 22 at 8:53
Akhilesh jjAkhilesh jj
133
133
New contributor
New contributor
@GIS_Esri: Do you want cross join? or not? describe more plz.
– Taras
May 22 at 9:14
Have you had a look atconnect by lines
(search forconnect
in the tool box)? Feature names may be added afterwards using the field calculator. Could this suit your needs?
– Erik
May 22 at 9:25
add a comment |
@GIS_Esri: Do you want cross join? or not? describe more plz.
– Taras
May 22 at 9:14
Have you had a look atconnect by lines
(search forconnect
in the tool box)? Feature names may be added afterwards using the field calculator. Could this suit your needs?
– Erik
May 22 at 9:25
@GIS_Esri: Do you want cross join? or not? describe more plz.
– Taras
May 22 at 9:14
@GIS_Esri: Do you want cross join? or not? describe more plz.
– Taras
May 22 at 9:14
Have you had a look at
connect by lines
(search for connect
in the tool box)? Feature names may be added afterwards using the field calculator. Could this suit your needs?– Erik
May 22 at 9:25
Have you had a look at
connect by lines
(search for connect
in the tool box)? Feature names may be added afterwards using the field calculator. Could this suit your needs?– Erik
May 22 at 9:25
add a comment |
1 Answer
1
active
oldest
votes
In QGIS, you can create a Virtual layer (Edit Menu > Create Layer > New Virtual Layer) with the code below :
SELECT t3."SI No",
t3."Link ID",
t3."Link Desc",
make_line(ST_GeomFromText(t3.ptfrom), ST_GeomFromText(t3.ptto)) AS geom
FROM (SELECT "Table2"."SI No",
"Table2"."Link ID",
"Table2"."Link Desc",
ST_AsText(t1from.geometry) AS ptfrom,
ST_AsText(t1to.geometry) AS ptto
FROM "Table2"
INNER JOIN "Table1" t1from ON "Table2"."From" = t1from."Object name"
INNER JOIN "Table1" t1to ON "Table2"."To" = t1to."Object name") AS t3
Usually, the SQL query is more simple but here, I've tried to reproduce your case with two memory layers (Table1 point, Table2 no geometry) and I had to transform point geometry into text (WKT) to have both Table1 fields.
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
you can remove the outer query and build the line directly using the geometriesmake_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@J.Monticolo, yes
– Taras
May 22 at 11:18
|
show 1 more comment
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Akhilesh jj is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f323529%2fconnect-points-using-line-different-table-in-qgis3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In QGIS, you can create a Virtual layer (Edit Menu > Create Layer > New Virtual Layer) with the code below :
SELECT t3."SI No",
t3."Link ID",
t3."Link Desc",
make_line(ST_GeomFromText(t3.ptfrom), ST_GeomFromText(t3.ptto)) AS geom
FROM (SELECT "Table2"."SI No",
"Table2"."Link ID",
"Table2"."Link Desc",
ST_AsText(t1from.geometry) AS ptfrom,
ST_AsText(t1to.geometry) AS ptto
FROM "Table2"
INNER JOIN "Table1" t1from ON "Table2"."From" = t1from."Object name"
INNER JOIN "Table1" t1to ON "Table2"."To" = t1to."Object name") AS t3
Usually, the SQL query is more simple but here, I've tried to reproduce your case with two memory layers (Table1 point, Table2 no geometry) and I had to transform point geometry into text (WKT) to have both Table1 fields.
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
you can remove the outer query and build the line directly using the geometriesmake_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@J.Monticolo, yes
– Taras
May 22 at 11:18
|
show 1 more comment
In QGIS, you can create a Virtual layer (Edit Menu > Create Layer > New Virtual Layer) with the code below :
SELECT t3."SI No",
t3."Link ID",
t3."Link Desc",
make_line(ST_GeomFromText(t3.ptfrom), ST_GeomFromText(t3.ptto)) AS geom
FROM (SELECT "Table2"."SI No",
"Table2"."Link ID",
"Table2"."Link Desc",
ST_AsText(t1from.geometry) AS ptfrom,
ST_AsText(t1to.geometry) AS ptto
FROM "Table2"
INNER JOIN "Table1" t1from ON "Table2"."From" = t1from."Object name"
INNER JOIN "Table1" t1to ON "Table2"."To" = t1to."Object name") AS t3
Usually, the SQL query is more simple but here, I've tried to reproduce your case with two memory layers (Table1 point, Table2 no geometry) and I had to transform point geometry into text (WKT) to have both Table1 fields.
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
you can remove the outer query and build the line directly using the geometriesmake_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@J.Monticolo, yes
– Taras
May 22 at 11:18
|
show 1 more comment
In QGIS, you can create a Virtual layer (Edit Menu > Create Layer > New Virtual Layer) with the code below :
SELECT t3."SI No",
t3."Link ID",
t3."Link Desc",
make_line(ST_GeomFromText(t3.ptfrom), ST_GeomFromText(t3.ptto)) AS geom
FROM (SELECT "Table2"."SI No",
"Table2"."Link ID",
"Table2"."Link Desc",
ST_AsText(t1from.geometry) AS ptfrom,
ST_AsText(t1to.geometry) AS ptto
FROM "Table2"
INNER JOIN "Table1" t1from ON "Table2"."From" = t1from."Object name"
INNER JOIN "Table1" t1to ON "Table2"."To" = t1to."Object name") AS t3
Usually, the SQL query is more simple but here, I've tried to reproduce your case with two memory layers (Table1 point, Table2 no geometry) and I had to transform point geometry into text (WKT) to have both Table1 fields.
In QGIS, you can create a Virtual layer (Edit Menu > Create Layer > New Virtual Layer) with the code below :
SELECT t3."SI No",
t3."Link ID",
t3."Link Desc",
make_line(ST_GeomFromText(t3.ptfrom), ST_GeomFromText(t3.ptto)) AS geom
FROM (SELECT "Table2"."SI No",
"Table2"."Link ID",
"Table2"."Link Desc",
ST_AsText(t1from.geometry) AS ptfrom,
ST_AsText(t1to.geometry) AS ptto
FROM "Table2"
INNER JOIN "Table1" t1from ON "Table2"."From" = t1from."Object name"
INNER JOIN "Table1" t1to ON "Table2"."To" = t1to."Object name") AS t3
Usually, the SQL query is more simple but here, I've tried to reproduce your case with two memory layers (Table1 point, Table2 no geometry) and I had to transform point geometry into text (WKT) to have both Table1 fields.
edited May 22 at 10:01
Taras
2,7673830
2,7673830
answered May 22 at 9:47
J. MonticoloJ. Monticolo
2,153522
2,153522
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
you can remove the outer query and build the line directly using the geometriesmake_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@J.Monticolo, yes
– Taras
May 22 at 11:18
|
show 1 more comment
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
you can remove the outer query and build the line directly using the geometriesmake_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@J.Monticolo, yes
– Taras
May 22 at 11:18
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
Does it make any difference to use an alias instead of a nested query?
– Taras
May 22 at 10:03
you can remove the outer query and build the line directly using the geometries
make_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
you can remove the outer query and build the line directly using the geometries
make_line(t1from.geometry,t1to.geometry)
– JGH
May 22 at 11:07
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@JGH : I know, but it doesn't work with my two memory layers. Virtual Layers didn't want to show the two geometry fields from Table1, I don't know why and this is why I translate geom in WKT and reverse operation then.
– J. Monticolo
May 22 at 11:16
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@Taras : are you referring to t3?
– J. Monticolo
May 22 at 11:17
@J.Monticolo, yes
– Taras
May 22 at 11:18
@J.Monticolo, yes
– Taras
May 22 at 11:18
|
show 1 more comment
Akhilesh jj is a new contributor. Be nice, and check out our Code of Conduct.
Akhilesh jj is a new contributor. Be nice, and check out our Code of Conduct.
Akhilesh jj is a new contributor. Be nice, and check out our Code of Conduct.
Akhilesh jj is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f323529%2fconnect-points-using-line-different-table-in-qgis3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@GIS_Esri: Do you want cross join? or not? describe more plz.
– Taras
May 22 at 9:14
Have you had a look at
connect by lines
(search forconnect
in the tool box)? Feature names may be added afterwards using the field calculator. Could this suit your needs?– Erik
May 22 at 9:25