斯潘8
斯潘4
注:对于FME 2017及更新版本,现在支持python 3.4,不再需要下面描述的技术。
FME 2015随python 2.7一起提供,不支持python 3.0及更高版本。本文演示了在FME 2015中使用Arcgis Pro 64位python 3.4 arcpy库所必需的解决方案。
有关这两项要求的更多信息,请参见以下内容ESRI Arcgis Pro安装帮助(包括用于Arcgis Pro安装程序的python链接)。
为了调用python 3.4arcpy库,需要使用python子进程.call())功能。在这个例子中,py脚本是在fme中使用python版本2.7编写的。该脚本通过调用subprocess.call()函数来执行,并将使用python 3.4arcpy库在外部命令中运行。还提供了一个示例工作区来展示此工作流。亚搏在线
#可以使用python 3.4执行arcpy地理处理的关闭脚本示例。
导入fmeimport os查找写入的工作区,多边形功能类nameoutworkspace=fm.macrovalues['desttataset_filegdb']outpolygonfc=fm_featureswritten.keys()[0]获取所需的输出多边形功能类nameoutlinefc=fm.macrovalues['output_feature class']使用arcpy for python 3.4.import subprocessos.putenv('pythonpath','c:\python34\lib\site package运行地理处理步骤子流程将找到arcgispro.pth,从而找到正确的arcpypypython='c:\python34\pythonnw.exe'path='c:\temp\geprocess.py'handle=open(path,'w')handle.write('import arcpy\n')handle.write('arcpy.env.workspace=\n.forma(repr(outworkspace)))handle.write('if arcpy.exist(;):\n.format(repr(outdefc)))handle.write.write('arcpy.delete)arcpy.删除管理(删除)u管理()\ n'.format(repr(outlinefc)))handle.write('arcpy.polygontoline_management(in,out,neighbor,neighbor option=“identify neighbors”)\n'.format(repr(outpolygonfc),repr(outlinefc)))handle.close()print'\n调用python 3.4运行脚本。format(path)returncode=subprocess.call((python,path),shell=false)os.unlink(path)ED关闭处理。'pythonarcgisproexample.fmw
?2019安全亚搏在线软件公司|法律