Skip to main content
Solved

How to get data type of fields/attributes in a shp file

  • October 22, 2020
  • 3 replies
  • 347 views

Looking to drop a shp file into workspace and extract the data type of each field. e.g. Address.shp may have fields StreetName (text) and StreetNumber (int). I would like to be able to extract the type for each field:

StreetName - fme_char(254)

StreetNumber - fme_int32

 

I understand that FME maps the Data Types from different files based on the reader being used to an equivalent FME Data Type https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/!FeatureTypeProperties/attribute_types.htm

Best answer by ebygomm

Another option is to use FeatureReader to read the shapefile and choose to read Schema features only. The schema is returned as a list, so you would need a list exploder to break each list element into multiple features.

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.

3 replies

oscard
Influencer
Forum|alt.badge.img+22
  • Influencer
  • October 22, 2020

There is a Reader called Schema. I think it would give you the info you are looking for.


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • October 22, 2020

Another option is to use FeatureReader to read the shapefile and choose to read Schema features only. The schema is returned as a list, so you would need a list exploder to break each list element into multiple features.


  • Author
  • October 22, 2020

Another option is to use FeatureReader to read the shapefile and choose to read Schema features only. The schema is returned as a list, so you would need a list exploder to break each list element into multiple features.

I think this way works the best for my use, as I can just drop in one shape file and specify a user parameter in the FeatureReader transformer to extract the schema from it.