西班牙
斯潘4
我有一个需要加入的数据集。我需要FME来识别沿着分割的触摸特征之间的属性值不同,最好生成包含消息eg的单个属性。“这些属性不同:#,#,#,#,等等”。有成百上千的属性,我想不出一个简单的方法。
谢谢!
您好!@乔诺
下面提供的python代码将为每个特性查找列表。对于第一个元素,它将获取所有属性和这些属性的值,并将它们存储在字典中。接下来,代码将循环遍历每个列表元素的所有属性,如果该值与第一个元素的值不同,则属性名将列在属性“attribute_with_different_values”中。
import fme import fmeobjects import re-class FeatureProcessor(object):def\u init\uu(self):self.name\u list='\u list'def input(self,feature):attributes=feature.getAllAttributeNames();只保留那些链接到列表第一个功能的attributename,只保留属性本身的名称attributes\u to\u compare=[re.search('(?<=\.).*$',x).group(0)for x in attributes if re.search('{0\}',x)];将这些attribute name存储在字典中,字典中的属性值为value attributes;要比较的attributes中的cAttribute:attributes第一个元素[cAttribute]=feature.getAttribute('{}{{0}.{})。format(self.name撸list,cAttribute))\Now loop通过所有功能的所有属性,并检查其中哪些具有不同的值属性,其中具有不同的值属性,且具有不同的值属性=set()attributes=[x for x in attributes if re.search('{\d+\}',x)]for cAttribute in attributes:value=feature.getAttribute(cAttribute)name\u attribute=re.search('(?<=\.).*$',cAttribute).组(0)如果值!=attributes_first_element[name_attribute]:attributes_具有不同的值。add(name_attribute)#将具有不同值的所有属性存储在一个属性中以导出feature.setAttribute('attribute_具有不同的值',','。join(attributes_具有不同的值))self.pyoutput(feature)def close(self):pass
你要找的基本上是一个不同的探测器。在类似的情况下,我所做的是将属性从一个特征(参考特征)转移到另一个特征(比较特征)。我在一个关键属性上使用了featuremerge,但是您可能需要使用spatialRelator来代替。所有属性的前缀都是“ref”。
然后我使用pythonCaller循环遍历所有属性和测试,以查看ref_X是否匹配X,如果不匹配,则将属性名附加到列表属性(changeList{})。
然后可以使用ListConcatenator生成所需的单个属性。
?2019安全亚搏在线软件公司|合法的