I have a point grid that overlaps points on a map. I want to join this grid to the points in order to keep only the parts of the grid that contain a point.

However, there are some points that lie between the circles of the point grid (in the empty space) and therefore aren't counted as overlapping and aren't included in the output.

The whole point of my grid though is that it should cover the entire area. I know I could get it to join with these points by making the grid a square grid (and eliminating the empty space) or by making the circles of the point grid so large that they fill most of the empty space. However, I want to keep the circles the same size.

Is there a way of joining the circles of the point grid to a point that is NEARBY rather than actually touching?

  • it sounds like you want nearest neighbor join. There's a plugin for that, called NNJoin.
    – csk
    Feb 5 '20 at 19:00

If I understand your question correctly, I believe you may achieve what you want by using virtual layer and ST_Distance.

I have two point layers:

  1. point_grid (red points, 50 m x 50 m)
  2. random_points (smaller blue points)

point layers

Go to Layer - Create Layer - New Virtual Layer. Type in a layer name (e.g. "vl_gridselect"), click import and add the two point layers. Type in the desired query, e.g. find grid points within 30 meters from random points and select the attributes of both grid and random points.

select a.*, b.* from point_grid as a, random_points as b where st_distance(a.geometry, b.geometry) < 30

virtual layer

Click test to test the query. If OK, click Add.

A new layer is added (vl_gridselect) that contains the grid points within 30 meters from the random points. This virtual layer will contain all attributes from the grid points and random points.

You may the export the features of the virtual layer (right-click on the virtual layer, click Export and Save Features As).

enter image description here

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.