2

I would like to connect my points with one point at the different layer, like you see below:

enter image description here

enter image description here

but the simple option like Points to path doesn't work here, because it applies to one layer.

I found some options here:

Draw lines between points

and here:

Creating lines between Points in QGIS 3.6.2

where I tried to use the Geometry by expression. Unfortunately, I wasn't successful.

I also tried the Point Connector plugin:

https://www.youtube.com/watch?v=aZTpZ_NzwN8&ab_channel=NextGIS

but it doesn't work as expected. enter image description here

I need to link all the selected points with one green point, which is already under a different layer, and repeat this step for other green points, where other points will be allocated (like you can see in the data attribute table above).

Is there any way to make the lines between points, where some points must be allocated to the other point belonging to the different layer?

UPDATE:

I tried to use the Join by lines option as pointed out in the comment below:

Joining many points with lines?

by creating the same column in the data attribute table

How to copy same values to another field in attribute table in QGIS using field calculator?

which now looks like this:

enter image description here

but it didn't work, I have the "Hub lines" created, but my new data attribute table is empty.

enter image description here

What am I doing wrong here?

6
  • 1
    Why don't you place all your points in one third layer and add a string attribute to store the layer it comes from?
    – Pepe N O
    Feb 18, 2022 at 17:35
  • Are the lines just for visual purpose or do you want to create a new line layer?
    – BERA
    Feb 18, 2022 at 18:06
  • @BERA yes, lines show the correlation between points I want. As you can see in the attached attribute table - to the point ended 1 I need 4 points.
    – Geographos
    Feb 18, 2022 at 18:49
  • 1
    Have you tried using the processing algorithm Join by lines (hub lines)? from my quick test it seems to be perfect for your case
    – pigreco
    Feb 18, 2022 at 20:06
  • I will try it tomorrow, thanks
    – Geographos
    Feb 20, 2022 at 18:40

2 Answers 2

2

OK, the basic solution is here:

Joining many points with lines?

but the primary reason, why I got nothing in the attribute date earlier was the wrong combination between the unique columns in both data attribute tables. Since the link above states, that it's enough when we use just unique columns (with unique data) between both data attribute tables I would say, that it's not always true. It depends on what our string is and does the column content matches itself between these 2 unique columns considered. If, for instance, we will have some discrepancies there, then the tool probably will throw just empty records. Thus much better is to use just ID as the unique column in both layers, it's the safest approach, which guarantees the result as below:

enter image description here

enter image description here

0

The simple answer to your question is because they belong to different layers. If snapping no problem but joining 2 different layers, I think cannot be done. Why not make a new layer which they are incorporated?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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