0

I have point data in a shapefile covering most of Africa. I've made 0.1x0.1 grids using the make grid option from QGIS and now I want to link the grid_id to my point data. Below you will find a picture of all my data points an the grid and a zoom in where the grids can be distinguished from each other - I want every point to get assigned a grid_id number base don which grid they are located in. Complete map zoom in

I've tried using join attributes by location, where my input layer was the point file and my join layer was the grids I've just made. I've experimented with other geometric predicates, but I would think I need to use the within option. However, when I run the program, he does not match any of the grid ids to my point data.

I've also tried using the MMQGIS spatial join option, but this won't allow me to select a spatial operation once I've selected the layers I want to combine.

Does anyone have any suggestions on how to link a grid_id to point data?

  • Check if both layers have the same coordinate reference system (CRS) (in each layers property). – geozelot Jun 25 at 9:48
  • @geozelot They do, both have EPSG 4326 - WGS 84. – Eline Jun 25 at 10:29
3

I've researched your trouble with the MMQGIS spatial join option. From what i've seen the problem is that the grid you've generated was a line layer. The MMQGIS does not support a spatial join operation between a point layer and a line layer. In the MMQGIS documentation says that:

"Spatial Operation: Indicates the spatial relationship that should be used in the operation. Some relationships are not available for some combinations of shapes (ex: there is no within relationship when joining a polygon target layer with a point join layer)"

In the make grid process you can set the type of grid to generate either squares (lines) or squares (polygons).If you generate a polygon type grid then you can set the spatial operation and run the process.

Here the polygon type grid and the point layer enter image description here

And here i can set the spatial join without problem

enter image description here

| improve this answer | |
  • Many thanks @Lcortes ! This solved my problem :) – Eline Jun 26 at 8:58

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.