1

Here is the workflow:

  1. I've imported lines from a shapefile
  2. I've used the Random points along line tool to generate points all across the previously imported lines
  3. Then in Vector > Data Management > Join Attributes by Location, I select both lines and points layers, select "Use first localized entity" and run the job

In the end, it never generates any points, as if it was unable to spatially find on which lines a given point is located (which is surprising since the points were generated from lines).

Am I missing something? Tested in the latest version of QGIS and in version 2.18.

Is there any way to spatially join attributes of two layers together?

I've tested in ArcGIS Desktop 10 and it works fine.

  • try to generate a vector layer with some small buffer from your line layer, then apply the join on the buffered lines – Hicham Zouarhi Oct 27 '17 at 13:49
  • That happens probably because you do not have vertices on the line at the locations of the points which were calculated by the function. Now the Join attributes is making another calculation to check if generated points are exactly on top of the line. Just a slight difference in the algorithms makes join to fail. Applying some buffer to points or lines should help. – user30184 Oct 27 '17 at 15:08
  • @user30184 gotcha, I was thiking it would be what actually happen, still I find a little bit sad as it works fine in ArcGIS and MapInfo without creating a buffer – Stranded Kid Oct 27 '17 at 15:27
  • Tolerance as a parameter would be nice in some functions. Oracle tries to avoid such errors by introducing a tolerance into each coordinate docs.oracle.com/cd/B28359_01/appdev.111/b28400/…. That has some drawbacks as well, for example geometries which are exported from Oracle do not necessarily snap to each other even they should when used with other programs. – user30184 Oct 27 '17 at 15:41
1

The join attributes by location tool give you the ability to set a tolerance.

I tested with 0 then 1 then 2 :

  • The result which give coherent result is with tolerance set to 2.
  • When you use 1, some feature are joined but not all points.
  • 0 give no result.

enter image description here

enter image description here

  • Thanks. In the latest version of QGIS I do not have the possibility to set a tolerance, but in the 2.14 it works fine. Nonetheless I've noticed that with some lines being really close to each other, sometimes the join returns the wrong line. So I'll stick with using ArcGIS for the time being. – Stranded Kid Nov 3 '17 at 12:53

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.