In QGIS 3.18.1 I am doing sampling to estimate deer densities.

I would like to know which tool I can use to specifically name points within quadrants. There are four points in a quadrant, each point must have a specific name. South-West point = 1, North-West point = 2, North-East point = 3, South-East point = 4.

The name of the point will then be made up of the name of the quadrant and the name of the point.

Example for point name in quadrant: 440_82_(1); 440_82_(2); 440_82_(3); 440_82_(4)

enter image description here

Here is a sample design for our data.

enter image description here

  • 1
    Can you please provide a sample of your data?
    – Taras
    Commented Oct 28, 2022 at 7:49

2 Answers 2


You can create a virtual layer. The query will calculate the azimuth from each polygons centroid to all intersecting points. Replace "centroids" and "grid" with the names of your layers:

select pnt.*, 
    when degrees(azimuth(centroid(poly.geometry), pnt.geometry)) between 40 and 50 then 3
    when degrees(azimuth(centroid(poly.geometry), pnt.geometry)) between 125 and 145 then 4
    when degrees(azimuth(centroid(poly.geometry), pnt.geometry)) between 215 and 235 then 1
    when degrees(azimuth(centroid(poly.geometry), pnt.geometry)) between 305 and 325 then 2
    else 999
end as 'bearing'
from centroids as pnt
grid as poly
on st_intersects(pnt.geometry, poly.geometry)

enter image description here


Check for each point the azimuth (angle clockwise from north) of a line from the centroid of the grid cell and allow for a certain tolerance - like in this visualization: which of the four red wedge-buffers contains the point? enter image description here

Use this expression to create the numbers from 1 to 4 depending on the quadtant. The expression calculates the azimuth (direction) from the centroid of the grid cell to the point and assignes values 1 to 4 as desired.

Then combine this result with the name of the grid cell using concat() function or pipes ||:

        azimuth (
        when @azimuth > 10 and @azimuth < 80 then 3
        when @azimuth > 100 and @azimuth < 170 then 4
        when @azimuth > 190 and @azimuth < 260 then 1
        when @azimuth > 280 and @azimuth < 370 then 2

For demonstration purpose, the expression used as dynamic label to create numbers from 1 to 4 to label the points: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.