Skip to main content
Solved

shapefile FID field

  • October 8, 2019
  • 4 replies
  • 226 views

dms2
Contributor
Forum|alt.badge.img+11

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.

Best answer by jdh

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • Best Answer
  • October 8, 2019

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.


dms2
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • October 9, 2019

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)


chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • May 25, 2021

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.