Shapefiles (vector layers) has FID or OID fields associated with each row (feature). This information is readily available in the attribute table viewed in Arcmap. However, QGIS Desktop does not seem show the FID field. Does anyone know how to view FID field in QGIS Desktop?
Yes. Agree with the answer from DPSSpatial. FID is the unique identifier of an object within a table. Between, the ways to get FID in QGIS:
- In the field calculator, create a new column, named "Fid".
- With expression: @row_number - 1 (ArcMap's FID is starting with 0. But, @row_number is starting with 1).
What are you trying to do with these fields?
The FID or OID fields are completely arbitrary fields that are only used to organize features internally for display on the map in both QGIS and ArcMap. They should not be used to assign ID's to features nor should they be used in JOINS or RELATES of any kind.
You should create an ID field which is named relevant to your data, even if it begins with a 1,2,3 ROWNUM function to get you started... never rely on a field called FID, OID, or really ID to give your features unique identifiers. If QGIS doesn't display it, I trust this is the reason wh
Actually, FID is not an official shapefile term, but refers to the row number in the unsorted table. Since Esri originated the format, calling this an artifact of arcgis is rather strange. Being a row-number, it is not stored in a column of the attribute table (DBF). The row number is used to tie the row to a specific shape. FID can be seen in QGis when identifying a shape under Derived->Feature ID. Further, there is a field in the SHP specification called Record Number at byte 0 of the record header(s), 1 based. But: "The one-to-one relationship between geometry and attributes is based on record number. Attribute records in the dBASE file must be in the same order as records in the main file." So, there's a bit of ambiguity about record number here and I, for one, do not count on the SHP Record Number to be properly maintained. So, the idea of sorting/ordering by FID is to use the unsorted order, i.e. in original stored order. There is nothing arbitrary about that, and I wish, more generally speaking, that this sort of downtalking like "arbitrary artifact" is more often seen as a style potentially hiding ignorance or lack of interest. My reason to find this exchange is an attempt to unsort a feature set after sorting it on an attribute column. Sorting on @row_number did NOT restore the original order, sorting on $id, however, did. For my purposes, the comment of jpmc26 is the best answer.