I have a polygon shapefile which I have imported into QGIS, however it does not display X Y coordinates. Is there a way that I can identify the coordinate for the centroid of the polygon and display this in the attribute table?
The QGIS field calculator can do it with these built-in functions:
x( centroid( $geometry )) y( centroid( $geometry ))
Make sure to create a new field of type
real, with an accuracy of 8. You can even use a virtual field to avoid changing the datasource.