Thursday, 9 June 2016

Converting point layer to raster grid that shows frequency of points per cell uisng QGIS


I have a point layer that shows the distribution of a species.


Is it possible in QGIS to convert this point layer to a raster grid in which the value of each cell corresponds with the amount of points within that cell?


Until now, I only managed to attach attribute values to the grid cells. I have already added a column in my attribute table that has the value '1' for each point, hoping that there is a way to use a sum of attributes for each grid cell.



Answer



This is a kludge but it does work - haven't found a way to go directly from points to raster yet (but am hoping someone gives a solution here!).


Starting with a point grid (random points in the Serengeti from the Vector|Research tools|Random points tool):


enter image description here


Create a polygonal grid of the same extent and cell size as the raster you'd like to have (this from Vector|Research tools|Vector grid):


enter image description here



Use Vector|Analysis tools|Points in polygon, using the polygon grid and the point layer:


enter image description here


This gives you a new grid (here colour coded by the number of points in each polygon cell):


enter image description here


Now use Raster|Conversion|Rasterize to convert this to a raster, using the PNTCNT attribute for the raster values and the same cell size as chosend for the grid:


enter image description here


... giving a raster with values as per the points in each cell:


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...