- Software: QGIS 2.4-2.8
- Operating System: Windows, Linux, Mac
Sometimes you need to uniquely identify data. I have one client for which I generate points and those points must be unique. This tutorial won’t create an updating unique value like a trigger in postgis or other database software. It will give your data a unique identifier for a feature.
1. Open your data in QGIS – in this example I have points that have been generated and fall within a boundary.
2. Open the attribute table and toggle editing mode on the point file.
3. In this case I’m not only going to have a unique number – but I’m going to add some letters to it. As an example M1. Open the field calculator.
4. There are two ways I have done this – one is using the Function $id and one is using the function $rownum. Both of these functions can be located under Record in the function list.
- Create a new field called name
- output field type string
- Default to 10 characters
- Under expression enter ‘M’ || $rownum
5. Click OK. You now have a unique attribute for your point file.