5

I have digitized land use and land cover polygons and am curious as to why the "id" attribute (presumably automatically assigned and populated) is either NULL or blank for my polygons.

Geometric validation reports feature "id"s, but I cannot relate them to my data. Is there a way to automatically set the "id"s?

1 Answer 1

5

You can use the following field calculator expression to calculate the feature id:

 $id 

You can use the following field calculator expression to calculate the row number:

 @row_number

References:

6
  • 1
    Thanks. So the id is simply the row number? What happens if I delete a feature? Are the ids re-shuffled? Commented Sep 23, 2019 at 21:32
  • 2
    Unless you create a new unique id field and assign a unique id to each feature, the row_number as well as the feature id will be 'reshuffled' when you add or delete features
    – jbalk
    Commented Sep 23, 2019 at 22:25
  • 2
    I added some another calc for the feature id
    – jbalk
    Commented Sep 23, 2019 at 22:26
  • P.S. @jbalk, sorry that I interfered in your answer, however, I found these sources vital and most likely relate to the topic.
    – Taras
    Commented Sep 24, 2019 at 5:17
  • @Taras That's ok. Those are good extras. Thanks.
    – jbalk
    Commented Sep 24, 2019 at 17:07

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.