I have
- a grid (10 x 10 km) where each cell is identified by a code
- a shapefile, a point layer, with the year when each point was sampled
as shown in the figure below.
As you can see from the image below, the year is identified by a color and in each cell I have many points of different years.
What I want to obtain is an intersection between the two layers, specifically, I want the same grid with a new column showing the year(s) of the points within each cell. I show you below an example
Cell_ID Year_of_sampling
10kmE275N271 2014-2015
10kmE276N271 2015
10kmE277N271 2013-2016
10kmE278N271 2013-2015-2016
It seems an easy task, but with Vector -> Geoprocessing -> Intersection
is not possible. Any ideas?
ST_INTERSECTS()
intoST_WITHIN()
. Alternatively, you may be interested in this Assigning each point name of polygon in which it lies using QGIS?.DISTINCT
inside of the queryGROUP_CONCAT(DISTINCT year)
ST_ITERSECTS()
both are acceptable eitherST_ITERSECTS(points, grid)
orST_ITERSECTS(grid, points)
. When you useST_WITHIN()
it should beST_WITHIN(point, grid)
and notST_WITHIN(grid, point)
Bypoint
andgrid
I mean their geoemtries