I'm having some trouble using the join by location feature in QGIS (2.18). I have a data set of ~7000 points, and another polygon data set. Both are ESPG3573 shapefiles. However, when I join by location many points that are within the polygon don't join properly. I get a lot of "NULL" fields. When I adjust the precision, it reduces the number of NULL joins, but also joins some locations inaccurately.

I've tried every geometric predicate and precision adjustment I could imagine.

  • Target: points_layer. Join: polygons_layer. Predicate: within. Precission: 0. Sumary: Take attributes of the first located feature. Statistics: (empty). Joined table: Only keep matching records. Does it solve your issue? – Gabriel De Luca Feb 16 '19 at 22:25
  • That does work. However, about 2000/7000 points are a few meters outside each polygon. So I lose a good portion of the dataset by only keeping the matching results. When I adjust the precision to 10,15,20, this reduces the number of "NULL" fields to about 700. As I continue to increase the precision threshold, the joined fields become less accurate. Even points within the polygon sometime will join with the information from the adjacent polygon. – taylorcameron Feb 16 '19 at 22:40
  • I suggest trying 3.4 - 2.18 is no longer supported and these tools have improved dramatically since that release – ndawson Feb 16 '19 at 23:00

NULL values are non-matching records. You can avoid them with the Only keep matching records option.

The tool doesn't return incorrect values.

If you set the within predicate and the precision to zero, the tool will return the polygons in which each point is within. Then, if there are more than one polygon that meets the condition, the tool can return the values of one of them (without guarantees of which one) or the aggregate function/s of the values of all them.

If you set a precision greater than zero, it is expected that polygons in which the point is not within, are returned as a match.

It occurs to me that the query you are looking for is the one that returns the polygon at the shorter distance from the point, but that predicate is not among the possible ones in that tool.

| improve this answer | |

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.