Question

Dynamically set File Geodatabase geometry type based on attribute

  • 4 September 2017
  • 1 reply
  • 4 views

Badge +7

I've built a Workspace to process an export file from a GIS system with the following structure:

Layer name + comma separated attributes

Unique ID (like ESRI Object ID)

X Y

X Y

X Y

Layer name + comma separated attributes

Unique ID (like ESRI Object ID)

X Y

X Y

X Y

If the last X and Y are the same as the first for that feature, it's a polygon layer, otherwise it's a line. Point layers have the X and Y as part of the layer name and comma separated attributes line.

I extract the Unique ID for each feature and add it to the rows that are part of that feature. I then split the attribute rows from the vertex rows. Vertex rows go through the LineBuilder which outputs the results through the Point, Line, or Polygon port as appropriate.

Based on which port the data comes out of, I'd then like to set the geometry type as an attribute or parameter to use in the Writer when I create the File Geodatabase feature class. I'm aware that I would need to use drop and create as trying to insert points into a line feature class wouldn't work.

However, this doesn't seem possible. The best I think I can do is to have 3 Writers, one for each geometry type and use AttributeFilter (using my geometry type attribute) or GeometryFilter to direct features to the appropriate Writer.


1 reply

Userlevel 4

You either have to use 3 writers (as you say), or you could use dynamic schema on the writer.

The latter is a lot more flexible, but also more complicated, particularly if it's the first time you use it. There's no hard and fast rule on when to use what, you'll have to decide for each case if it's worth the extra effort.

Examples here: https://knowledge.safe.com/articles/1051/index.html

Reply