Question

Can I rename or remove duplicate field names?

  • 24 April 2020
  • 5 replies
  • 24 views

Badge

I have a dynamic workbench that reads shapefiles and exports them to a FGDB. I have a .shp that had a few duplicate field names and wouldn't export to FGDB until I removed them. Is there a Transformer that will flag these duplicate fields and remove or rename them?


5 replies

Userlevel 4
Badge +30

Hi @inframan

Could you share us a sample of your data?

 

Thanks in Advance,

Danilo

Badge

Hi @inframan

Could you share us a sample of your data?

 

Thanks in Advance,

Danilo

I can't share the data but here's an example. ESRI sees these as different names, probably due AREA using an alias, but FME sees that the true name of both of these fields is "SHAPE_AREA" and is unable to export them into the same FGDB coverage.

Badge +2

@inframan I think Shape_Area is a calculated field in Geodb, so just remove it form your features before they enter the writer feature type. AREA might be an alias for shape_area so you could probably remove that as well.

Badge +3

@inframan I think Shape_Area is a calculated field in Geodb, so just remove it form your features before they enter the writer feature type. AREA might be an alias for shape_area so you could probably remove that as well.

@markatsafe, you actually have to explicitly define that you want SHAPE_Area or SHAPE_Length as output to an FGDB Writer, but the values themselves can be Missing or NULL, otherwise they won't appear in the FGDB output.

Weirdly enough, SHAPE_Area and SHAPE_Length are not mandatory or system fields in a File Geodatabase, even though users are used to them appearing automatically when they create a Feature Class through the ArcGIS interface. However, they are optional fields as far as the FGDB format is concerned and they can be added or deleted at any time. They are just normal fields but with reserved names that cause different behaviour inside the ArcGIS environment. If you name or manually add a field called "SHAPE_Area" or "SHAPE_Length", then ArcMap will then automatically start updating it inside an ArcGIS session.

It would be nice if this was parameterized in later FGDB Writers to say "Add Shape Area/Length Fields Yes/No", but for the moment, you have to manually add an Attribute named SHAPE_Area and/or SHAPE_Length with an Eg. AttributeManager with either Missing, NULL, or initial values (choice is up to the user) in order for them to appear in an FGDB, and for ArcGIS to then recognise them as fields with reserved names that it will then start auto-calculating and updating the FGDB with values retrieved from the geometries in the background.

Badge +3

As Shape Files do not natively have, nor support the auto-updating of, Shape_Area fields, then it is likely the AREA and Shape_Area fields came from the original data format that was exported into Shape, most likely an ESRI Geodatabase.

There are also no Alias' for Shape File Fields, so AREA and Shape_Area in the sample data appear to be physically two separate fields, and indeed in the sample data have different numeric values. It appears that AREA was added later, perhaps through the ArcGIS "Add Geometry Attributes" ArcTool where "AREA" is the default field name that it will output to.

So, FME should see them as two separate fields since they are physically two separate fields. They seem to on test SHP files I've tried.

Reply