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?

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:

| improve this answer | |
  • 1
    Thanks. So the id is simply the row number? What happens if I delete a feature? Are the ids re-shuffled? – Steve Miller Sep 23 '19 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 Sep 23 '19 at 22:25
  • 2
    I added some another calc for the feature id – jbalk Sep 23 '19 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 Sep 24 '19 at 5:17
  • @Taras That's ok. Those are good extras. Thanks. – jbalk Sep 24 '19 at 17:07

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.