span8
span4
日期:2018.06.20作者:Paal S. Pedersen# 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记住揭露创建的属性
jkr_da评论·
我认为这是非常反直觉的,你可以用一个造物主创造与几何形状的功能,但不能创建属性的要素。我有时用一个造物主与几何创建我的FeatureReaders空间滤波器。但是,我必须使用AttributeCreator为我的WHERE子句创建的参数。
因此,这将是很好的移动造物主的GeometryReplacer(可创建几何图形的话)的几何形状的选择和重命名创建者入门。或整合AttributeCreator选项加入到创造者。
分享你的好想法,或通过其他人的想法投票助阵。
©2019安全亚搏在线软件公司|法律