I created the following grid points by using the "create grid" pluggin from the processing toolbox, then "Intersection" to clip from a mask. My idea was to calculate the coordinates of these points with "Add X/Y fields to layer".

The issue is that I don't understand my attribute table. I was expecting to have 2 fields, but I have no idea what "top, right, left, bottom" represent. The issue is that because I have 4 fields, I fail to calculate the coordinates of the points with "Add X/Y fields to layer".

How could I calculate the coordinates of my points?

Why does the output of "Create grid" give 4 columns of data (aside from the indexes etc...)?

enter image description here

1 Answer 1


You have got four columns in the output point grid because you have got the four corner points of each polygon grid.

To see it visually, create a point grid layer, as you have already done, and specify the x and y spacings:

enter image description here

you will get the following grid of points:

enter image description here

Now, create a polygon grid with the same xy spacing, and the same extent of the point grid layer:

enter image description here

You will see that the point layer represents the corner points of the polygon grid layer:

enter image description here

This is the reason why you get four column in the point grid because each point in the point grid resents one corner of one polygon in the polygon grid.

If you want to get the centroid of the polygon grid, go to Vector -> Geometry tool -> Centroid, and select the polygon grid as input layer and click OK. You will get the following centroid layer:

enter image description here

The centroid attribute table still contains the attribute table of the polygon, which are the four columns in the attribute table, but you can delete them, and add new two columns that store x and y coordinates of the centroid points.

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.