Skip to main content
Archived

Creator - now with attributes

Related products:Transformers
  • January 28, 2015
  • 10 replies
  • 121 views

fmelizard
Safer
Forum|alt.badge.img+21
Instead of creating features with no attributes, enhance the creator to optionally allow a table of attributes and values to be used to populate a series of features, one per row of the table.
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.

10 replies

lars_de_vries
Forum|alt.badge.img+10
I think it would be better to use the AttributeCreator to do this, to have better control of your workbench. It is the same as exposing attributes in your reader or use the AttributeExposer to do so. For WorkbenchManagement purposes I would prefer to do the last. For a tidy workbench it would be a good alternative (and of you can always choose to do the last if the first is made available).

jkr_wrk
Influencer
Forum|alt.badge.img+36
  • May 30, 2018

I think it is very counter-intuitive that you can use a Creator to create an Feature with geometry but can not create a Feature with Attributes. I sometimes use a Creator with geometry to create a spatial filter for my FeatureReaders. But I have to use a AttributeCreator to create the parameters for my WHERE clause.

So it would be good to move the geometry options of the Creator to the GeometryReplacer (Which can create geometry already) and rename the creator to Starter. Or to integrate the AttributeCreator options into the Creator.


fmelizard
Safer
Forum|alt.badge.img+21
  • Author
  • Safer
  • May 30, 2018

You can create one attribute and assign a value, on the feature(s) coming out of the Creator.


paalped
Contributor
Forum|alt.badge.img+5
  • Contributor
  • June 20, 2018

 

PythonCreator can do this for you:

 

""" Date: 2018.06.20 Author: Paal S. Pedersen """ import fmeobjects class FeatureCreator(object): def __init__(self): pass def input(self,feature): # Create a Point feature pointFeature = fmeobjects.FMEFeature() # To create 3d objects we must .setDimension(fmeobjects.FME_THREE_D) # For 2 dimensional use .setDimension(fmeobjects.FME_TWO_D) pointFeature.setDimension(fmeobjects.FME_THREE_D) # To set the correct GeometryType use .setGeometryType, or else feature will be undefined # A list of valid geometries can be found in the doc # See help(feature) # Or help(fmeobjects) for a complete documentation of fmeobjects pointFeature.setGeometryType(fmeobjects.FME_GEOM_POINT) # Lets add a coordinate with x, y, z = 0, 0, 1 pointFeature.addCoordinate(1,1,0) # Lets create a dictionary with som attributes point_attributes = {'TYPE':'POINT', 'HAS_ATTRIBUTES': 'YES'} # Make a loop to itereate the attributes and set them to the feature for attribute_name, attribute_value in point_attributes.items(): pointFeature.setAttribute(attribute_name, attribute_value) # Now send this feature back to FME self.pyoutput(pointFeature) # Lets create a polygon polygonFeature = fmeobjects.FMEFeature() # Repeat procedure polygonFeature.setDimension(fmeobjects.FME_TWO_D) polygonFeature.setGeometryType(fmeobjects.FME_GEOM_POLYGON) # Lets create some coordinates coordinate_list = [(0,0), (0,10), (10,10), (10,0), (0,0)] # Make a loop to place each coordinate on the feature for x, y in coordinate_list: polygonFeature.addCoordinate(x,y) # Send the feature back to FME self.pyoutput(polygonFeature) def close(self): pass

 

Remember to expose attributes created

ecthelion
Contributor
Forum|alt.badge.img+18
  • Contributor
  • June 28, 2022

By right-clicking on 'Created', you can add (one at a time) as many attributes as you like - with default values.


LizAtSafe
Safer
Forum|alt.badge.img+18
  • Safer
  • February 8, 2024
The following idea has been merged into this idea:

All the votes have been transferred into this idea.

LizAtSafe
Safer
Forum|alt.badge.img+18
  • Safer
  • February 8, 2024
The following idea has been merged into this idea:

All the votes have been transferred into this idea.

LizAtSafe
Safer
Forum|alt.badge.img+18
  • Safer
  • February 8, 2024
The following idea has been merged into this idea:

All the votes have been transferred into this idea.

LizAtSafe
Safer
Forum|alt.badge.img+18
  • Safer
  • February 8, 2024
The following idea has been merged into this idea:

All the votes have been transferred into this idea.

andreaatsafe
Safer
Forum|alt.badge.img+15

Thanks for all the feedback on adding attributes to the Creator transformer. After reviewing the suggestions, we’ve decided not to proceed with this change right now.
The Creator is designed mainly for creating geometry features, and adding attribute functionality could complicate its core purpose.

For now, using workarounds like the AttributeCreator after or adding attributes on the output port is the best approach.

We might revisit the Creator’s overall functionality in the future, but for now, this change isn’t on the table.

Thanks for your understanding!