GP工具FeatureClassToFeatureClass和ExportCAD

GP工具FeatureClassToFeatureClass和ExportCAD

FeatureClassToFeatureClass

有三个主要参数:
in_features: 可以是IFeatureLayer/FeatureClass/String类型,其中,如果是IFeatureLayer类型时,如果图层中存在选中要素,则默认导出选中的要素,而IFeatureLayer.FeatureClass则是全部要素;
out_path: 文件保存路径,可以是文件夹/要素集/mdb数据库/gdb数据库;
out_name: 导出的文件名称

ExportCAD

有三个主要参数:
in_features: 传入IFeatureLayer或者IFeatureClass时,未知原因报错,因此采用了先利用 FeatureClassToFeatureClass 工具生成临时shp文件,然后传入shp文件的String路径的方法,但影响效率,有待改善;
Output_Type: 生成的CAD文件类型,包括DGN_V8, DWG_R14, DWG_R2000, DWG_R2004, DWG_R2005, DWG_R2007, DWG_R2010, DXF_R14, DXF_R2000, DXF_R2004, DXF_R2005, DXF_R2007, DXF_R2010;
Output_File: 导出的路径以及导出文件的全名(要求包括后缀dwg/dxf)

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 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、付费专栏及课程。

余额充值