1

How do you calculate centroids in QGIS 3.0? In previous versions, there was an easily accessible tool in the vector geometry toolbar, but it is gone. I've seen ways to do it with Python on Stack Exchange but I am not that good with Python.

I've tried a few Python plugins to no avail. I've repeatedly got the response "Couldn't load plugin 'realcentroid' due to an error when calling its classFactory() method", which I do not understand.

0

2 Answers 2

4

It is available in the "Vector -> Geometry tools -> Centroids" menu. You can also access it from the processing toolbox, just open it (menu "processing -> toolbox") and search for centroid.

2
  • Wow I realized that after posting this. Stupidly obvious! Is it good form to delete a question like on SE this now that I have answered it? Commented Apr 2, 2018 at 21:03
  • No, it does no harm and it could be useful to someone one day.
    – Leyan
    Commented Apr 3, 2018 at 18:52
0

If you open your attribute table you can always open the field calculator, add a virtual field and use an expression such as : x(centroid($geometry)) and y(centroid($geometry)) ...

That's a way to do what you're looking for.

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