你的浏览器禁用了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 如何获取线要素起点 终点坐标
Arcgis for server 集群调用
如何在EXCEL里把指定时间范围内值分字段求和
ArcGIS JS API同时调用天地图和超图服务冲突?
CityEngine能否通过写脚本建模
SOE如何发布Arcgis的python脚本
ArcGIS Runtime SDK for Android 100.0.0能不能调用ArcGIS online或者portal中的三维场景呢???
问题状态
最新活动:
2019-05-22 08:47
浏览:
5096
关注:
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
赞同来自:
要回复问题请先登录或注册
发起人
相关问题
问题状态