QGIS Rasterization – How to Create 3×3 Pixel from One Point in QGIS

pointqgisrasterization

I need 135 raster values of raster from 15 points.
So, I want 3×3 pixels (9 raster values) from each point.

enter image description here

To make them, I tried "Rasterize" to convert points as shown below. (In this QGIS session, there are 2 layers, Point layer(Input layer) & Raster layer (Output extent).)

enter image description here
But, after trying, I couldn't find the 9 pixels even at maximum zoom scale.

Should I change the parameters of Rasterize or think out another way?

For your information,

1.Properties of my raster data are shown below.
enter image description here

2.The points were made by clicking on the map.

If my sentences confuse you, I'm sorry for it.

Best Answer

You can't rasterize a point as it has no dimensions. First create a polygon around your point, then rasterize this.

Version 1 (straightforward)

  1. As on your screenshot, you have set a pixel size of 10 * 10 and you want a 3 * 3 pixel raster, I suppose the polygon should be 30 * 30 meters with the point in the middle of it. To create such a square around your point, use Geometry by expression (Menu Processing / Toolbox / Geometry by expression - see also here for how to use it) with this expression:
   make_regular_polygon( 
       $geometry, 
       project (
           $geometry, 
           15,
           0
       ),
       4,
       1
   )
  1. Rasterize the created polygon layer. Be sure to set Output raster size units to Georeferenced units and use a projected CRS (units in meters).

Version 2 (less straightforward)

There is another option, however, not so straightforward (depending on the spatial distribution / extent of your points). You'll get 30 * 30 meter polygons all over the extent of your point layer, whereas in the solution above, you create polygons only where you have points.

  1. Create a grid (Menu Vector / Research Tools / Create Grid), set it to Rectangle (polygon) with grid extent from your point layer (and in the same, projected CRS), horizontal and vertical spacing to 30. If your points are far away, you'll get a huge grid with a lot of cells (that's why the other option is faster).

  2. Use Menu Vector / Data Management Tools / Join attributes by location to select the cells that contain a point. Create a new attribute for them with field calculator that contains the value to be used for rasterization.

  3. Rasterize the grid.

Related Question