调用GP工具

 

实例:调用GP工具,DWG转换为SHP,不过好像属性信息没有转换过去。

 

private void ConvertCAD2Shp(string filePath, string outPutPath)
{
            private Geoprocessor gp = null;

            gp = new Geoprocessor();
            gp.OverwriteOutput = true;

 

            IGPProcess tools = null;
            cadtoshpTools = new CADtoFeatureClass();
            cadtoshpTools.input_CAD_file = filePath;
            cadtoshpTools.output_feature_class = outPutPath;
            tools = cadtoshpTools;
            ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult result = gp.Execute(tools, null) as                    

                                                                     ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的WebGIS调用GP工具的代码,使用JavaScript和ArcGIS API for JavaScript实现: ```javascript require([ "esri/tasks/Geoprocessor", "esri/tasks/FeatureSet", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/Color", "dojo/domReady!" ], function(Geoprocessor, FeatureSet, Point, SimpleMarkerSymbol, Color) { // 创建GP工具对象 var gp = new Geoprocessor("http://myserver/arcgis/rest/services/MyGPTool/GPServer/MyGPTool"); // 创建一个点几何对象 var point = new Point(-118.15, 33.80); // 创建一个简单符号 var symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 1), new Color([0,0,0,0.25])); // 在地图上显示点 var graphic = new Graphic(point, symbol); map.graphics.add(graphic); // 创建GP工具所需的输入参数 var inputParams = { "Input_Point": point }; // 创建FeatureSet对象作为GP工具的输入 var featureSet = new FeatureSet(); featureSet.features = [graphic]; // 设置GP工具的参数 gp.setOutSpatialReference(new SpatialReference(4326)); gp.setOutputSpatialReference(new SpatialReference(4326)); gp.setProcessSpatialReference(new SpatialReference(4326)); gp.setUpdateDelay(500); gp.setParameter("Input_Point", featureSet); // 执行GP工具 gp.submitJob(inputParams, function(jobInfo) { // GP工具执行成功后的回调函数 gp.getResultData(jobInfo.jobId, "Output_Feature_Class", function(output) { // 处理GP工具输出结果 var featureLayer = new FeatureLayer(output.value.url, { id: "MyGPResultLayer" }); map.addLayer(featureLayer); }); }, function(error) { // GP工具执行失败后的回调函数 console.log(error); }); }); ``` 这个代码中,我们使用了ArcGIS API for JavaScript提供的`Geoprocessor`类来创建一个GP工具对象,然后设置GP工具的输入参数和执行参数,并调用`submitJob`方法来执行GP工具。在GP工具执行成功后的回调函数中,我们可以使用`getResultData`方法获取GP工具的输出结果,并将其显示在地图上。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值