QGIS – Create Density Map with Grid

densitypointqgisvector-grid

I want to create a map as shown in the image, where every grid cell shows the number of points (from a point shape layer) that are within a grid cell. The number of points in a grid cell shall be coded as different shades of red.

How can I achieve that in QGIS?

example map

Best Answer

From this point it is not clear what you would like to have as map in the end. If you need a vector file, do the following in QGIS:

  1. search for "create grid" in the toolbox and create the grid with the dimensions you need
  2. search for "count points in polygons" to count the number of points underlying each cell of the before-created grid
  3. Right click on the newly created layer and select properties=>style
  4. Select the style you want the layer to be shown in (to do this, in the dialogue select "graduated" as style, the attribute column name with the point number in it as "value" and then click "classify"
  5. Customize colors as you want

If you need a raster file, you can simply convert the vector file to raster (search "rasterize" in toolbox).

Keep in mind that "density" might be number of points per grid cell or number of points per actual grid cell area. In the second case, you would need to divide the attribute column of the number of points by the actual area of the grid cell using "[name of field with number of points]"/$area in the field calculator.

("field" equals "attribute column" in QGIS language )

Related Question