斯潘8
斯潘4
你好,
我有一组点和一个网格分区。每个点都分配给一个分区
我已经建立了一个包含分区中所有点的列表(按分区分组的列表生成器)
是否有方法获取列表中每个元素的特征几何图形?
几何图形是否保存在列表生成器中?
如果是这样,如何在python的元素列表中检索它?
到目前为止,我的列表中只有非类型的。
我看到我必须做一些像我的列表=feature.getattribute(列表的事情。
但是几何图形的属性名是什么?
以后我想做点什么
列表中每个元素的feature.getAllCoordinates()。
DEF输入(自身,功能):my_list=feature.getattribute(“_list”)flush the list self.flist=[]if my_list is not none and len(my_list)>0:for item in my_list:new_feature=feature.clone()self.flist.append(new_feature)self.dbscan(self.flist,EPS,self.minpts)else:partition=feature.getattribute(“partition”)self.logger.logmessagestring(“partition as no value:“.format(partition),”fmeobjects.fme_错误)
DEF输入(自身,功能):刷新列表self.flist=feature.splitAggregate(false)self.logger.logmessageString(“有点:”.format(len(self.flist)),fmeobjects.fme_error)self.logger.logmessagestring(“启动dbscan:”,fmeobjects.fme_错误)self.dbscan(self.flist,EPS,self.minpts)def dbscan(自我,D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D、D每股收益,minpts):corepoints=[f for f in d if self.getnbofneighbors(d,f,eps)>=minpts]self.logger.logmessagestring(“输出核心点:”,在corepoints:self.logger.logmessagestring(“输出点:”.format(str(f)),fmeobjects.fme_error)self.pyoutput(f)def distance3d(self,羽毛,featureb):coora=feature.getallcoordinates()coorab=featureb.getallcoordinates()[当前功能的节点号][coord组件x,Yz]xa=coora[0][0]ya=coora[0][1]za=coora[0][2]xb=coorb[0][0]yb=coorb[0][1]zb=coorb[0][2]d=math.sqrt((xa-xb)**2+(ya-yb)**2+(za-zb)**2)返回d
在属性列表中找不到几何图形(它只包含属性)。您必须迭代聚合部分并从每个部分提取几何图形,可能是这样的:
从fmeobjects import*if feature.getGeometryType()==fme_geom_aggregate:aggregate_parts=feature.splitAggregate(true)elif feature.getGeometryType()==fme_geom_donut:aggregate_parts=feature.getDonutParts()else:aggregate_parts=[feature,]for n,部分在枚举中(聚合部分):部分_geom=part.getgeometry()部分_objectid=feature.getattribute(%s.objectid'%n)在这里用“部分_geom”和“部分_objectid”做一些令人兴奋的事情…
您将在API文档中找到有关fmegeometry对象的更多信息:
http://docs.亚搏在线safe.com/fme/html/fme_objects_python_api/index.html
@戴维德
你好,感谢您的回复,
虽然现在我可以在inspector中看到所有按分区聚合的点,我对这行的结果还是一样的
my_list=feature.getattribute(“_list”)-->nonetype
我找不到几何图形
也许我在你的解释中遗漏了一些东西
当做,
西尔万
?2019安全亚搏在线软件公司|合法的