Is there a way to create an auto increment primary key column when creating a new Shapefile in QGIS?
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
As far as I know, Shapefiles have no concept of primary key or auto increment data types. What you can do is use Field Calculator to populate a column with row number. |
|||
|
|
A Shapefile has a OBJECTID field; which serves as its key and primary index which should suit your purposes. |
|||||
|
|
I get this question a lot on the pyshp mailing list and underdark is correct. The shapefile format provides no unique identifiers for geometry or attribute records. The object id, feature id, or other GUID is a trapping of the software you use and is just a row number assigned as the records are read in. The only options are to assign a new attribute using scripting or spreadsheet software, or load the data into a spatial database. |
|||
|
|