你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
问题
文章
话题
登录
注册
ArcGIS Engine
如何在C#中调用引用了arcpy的python脚本?
自定义python脚本,脚本中调用了arcpy,如何在C#中调用该脚本?
2 个回复
朱新颖
赞同来自:
【解决办法】:
1.可以将该脚本制作为脚本工具,然后在Engine中直接调用该工具,推荐使用此种方法。
2.如果无法做成脚本工具,可以尝试在.Net中调用该.py文件,参考AO帮助:
http://resources.arcgis.com/en ... 0000/
下面方式可以调用成功:
[code]
string strPyScFile = string.Format({0}\\{1}, Application.StartupPath, zxy.py); //.py文件的路径
//Parameters
string sArguments = string.Format({0}, strPyScFile);
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName =
@C
:\Python27\ArcGIS10.2\python.exe;//Python程序路径
p.StartInfo.Arguments = sArguments;
p.StartInfo.UseShellExecute = false;
// Do not create the black window.
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
p.WaitForExit();
string result = p.StandardOutput.ReadToEnd(); //获取输出信息
kongfankongfan
赞同来自:
我用c#调用arcpy,执行发布mxd到server的操作,此操作执行到print1就停止了好像,如上图代码,server没有发布成功,不知道什么原因?遇到过吗
要回复问题请先
登录
或
注册
发起人
朱新颖
相关问题
如何在GIS知乎上写文章呢?
ArcGIS中如何用Python给字段值补充0
如何使用脚本或其他方法,将图层属性中属性域原值内容替换为属性域描述?
如何利用ArcPY操作图层的“symbol”?
arcgis for python 如何获取线要素起点 终点坐标
如何在EXCEL里把指定时间范围内值分字段求和
Arcgis for server 集群调用
ArcGIS JS API同时调用天地图和超图服务冲突?
ArcGIS Runtime SDK for Android 100.0.0能不能调用ArcGIS online或者portal中的三维场景呢???
geometryEngine.simplify方法是做图形简化的吗,简化机制是什么,为什么调用后没效果?
Engine调用GP工具的两种方式的用法
问题状态
最新活动:
2019-05-22 08:47
浏览:
5473
关注:
2
人
2 个回复
朱新颖
赞同来自:
1.可以将该脚本制作为脚本工具,然后在Engine中直接调用该工具,推荐使用此种方法。
2.如果无法做成脚本工具,可以尝试在.Net中调用该.py文件,参考AO帮助:
http://resources.arcgis.com/en ... 0000/
下面方式可以调用成功:
[code]
string strPyScFile = string.Format({0}\\{1}, Application.StartupPath, zxy.py); //.py文件的路径
//Parameters
string sArguments = string.Format({0}, strPyScFile);
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @C:\Python27\ArcGIS10.2\python.exe;//Python程序路径
p.StartInfo.Arguments = sArguments;
p.StartInfo.UseShellExecute = false;
// Do not create the black window.
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
p.WaitForExit();
string result = p.StandardOutput.ReadToEnd(); //获取输出信息
kongfankongfan
赞同来自:
要回复问题请先登录或注册
发起人
相关问题
问题状态