Skip to main content

Is is possible to expose a shapefile's FID field?

Shapefile readers do not list it and I can't find how to expose it.

I need to store that field's value in a control field to keep track of the original features.

The FID is not a field that's part of the shapefile, it's an automatically generated objectID controlled by the ESRI software, if you edit the shapefile to delete a field, all the FIDs are regenerated.

 

 

It's not the best field to track changes to features, because it is not persistent file to file.

That said, use a Counter after the reader, starting at 0 in local mode. and you will end up with the equivalent of the FID. Note if you are reading multiple files, the counter name needs to be set to the fme_dataset so that the counter resets to 0 for each shapefile.


The FID is not a field that's part of the shapefile, it's an automatically generated objectID controlled by the ESRI software, if you edit the shapefile to delete a field, all the FIDs are regenerated.

 

 

It's not the best field to track changes to features, because it is not persistent file to file.

That said, use a Counter after the reader, starting at 0 in local mode. and you will end up with the equivalent of the FID. Note if you are reading multiple files, the counter name needs to be set to the fme_dataset so that the counter resets to 0 for each shapefile.

@jdh Got to the Counter solution myself. But it's good to know what to do when reading multiple files. Thanks!

BTW, no problem about using the FID field. input shapefiles are final versions and won't change.


How to get  a shapefile's FID field?(FME)


How to get  a shapefile's FID field?(FME)

Hi @xiangwei200911b​ ,

As jdh describes above, the FID field is only generated in Esri software. One option you have here is to use the Counter transformer and set it to the local mode. See their suggestion above for more.


Reply