I have a list of points and I want to insert attribute number for each point. The number should increase from 1 to the last point. (30 in the example below)

enter image description here

  • 1
    Perhaps this post might help: QGis Making Column Value of Attribute table unique – Joseph Jun 7 '17 at 11:10
  • @Joseph the rownum are mixed. I have couple of listings like above and I need to start from 1 everytime. – Guy Jun 7 '17 at 11:18
  • What do you mean by "list"? If each set of points is a separate layer, the linked solution will still work fine. – Senshi Jun 7 '17 at 12:08

If your points were not plotted sequentially, and you still need to label it from west to east (left to right), please give a try to MMQGIS sort function:

(1) Create a new field "x_loc" with an expression $x

(2) Activate MMQGIS plugin Menu | MMQGIS | Modify | Sort

(3) On Sort Attributes dialog windo, give your point layer (e.g. points) to sort (ascending) by "x_loc" field and save it to disk (e.g. C:/temp/sorted.shp).

enter image description here

(4) Open attribute table of this sorted layer and add new field "rownum" (expression $rownum) as a solution linked in Joseph's comment.

(5) Then the attribute may look like above RHS image. Annotate the points by "rownum" field. (black: original "id", red: "rownum")

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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