[GIS] Counting number of vertices of polygons and lines in QGIS

countqgisvertices

In QGIS, is there a way to count the number of vertices of polygons and lines in a given layer, and create a separate field containing these values?

I suspect it's a function somewhere in the field calculator but I can't find it.

Best Answer

Number of points - just simple formula in QGIS field calculator:

num_points($geometry)

See the screenshot below: in this case, the number of vertices of each feature is added to the field "vertex" in the attribute table. Alternatively, you can create also "Create a new field" and get results there.

enter image description here

Related Question