码迷,mamicode.com
首页 > 其他好文 > 详细

GIS有关GP服务的发布和调用

时间:2017-03-28 16:00:43      阅读:352      评论:0      收藏:0      [点我收藏+]

标签:nec   srp   hsi   tdm   fss   spn   ie11   smd   aar   

1、通过Modelbuilder新建工具。(注意:假如工具输出两个以上的结果,需要保存在相同文件及下,并将输入输出都设置为参数)

技术分享

技术分享

 

 

2、调用新建的工具,在result窗口中查看结果,工作是否正确。

3、发布服务时,参数要设置自定义,并且异步调用

技术分享

4、调用参数说明:

技术分享

5、参数输入世必须是字符串格式,json需要用JSON.stringify(obj);进行转换

6、调用时: usr1="https://localhost:6443/arcgis/rest/services/gp服务所在目录/gp服务名/MapServer/jobs/“+data.jobId;

7、范例:

button.onclick = function(){
                    var query = new esri.tasks.Query();
                    query.where = "1=1";
                    query.returnGeometry=true;
                    query.outFields = ["*"];
                    featureLayer.queryFeatures(query, function(ff) {
                        console.log("查询完成");
                        var gpServiceUrl="https://localhost:6443/arcgis/rest/services/gp服务所在目录/gp服务名/GPServer/gp服务名";
                        var gp = new esri.tasks.Geoprocessor(gpServiceUrl);
                        var obj=createObj(ff);
                        var str=JSON.stringify(obj);
                        //设置GP参数  
                          var params = {
                              GDP:str,
                              Field: "GDP"
                          };  
                          gp.submitJob(params, function(data){
                                console.log("complete");
                                console.log(data);
                                var usr1="https://localhost:6443/arcgis/rest/services/gp服务所在目录/gp服务名/MapServer/jobs";
                                var mapurl= usr1+"/"+data.jobId;
                                var hotspotLayer = new esri.layers.ArcGISDynamicMapServiceLayer(mapurl, {  
                                    "id": "bufferlayer"  
                                });
                                // hotspotLayer=new exri.layers.ArcGISTiledMapServiceLayer(mapurl, {  
                                //     "id": "bufferlayer"  
                                // });
                              map.addLayer(hotspotLayer);  
                              var s=map.layerIds;
                              console.log(s);
                            }, function(data){
                                console.log("status");
                                console.log(data);
                            }, function(data){
                                console.log("failed");
                                //console.log(data);
                        });
                    });
                }  
            }); 

 

GIS有关GP服务的发布和调用

标签:nec   srp   hsi   tdm   fss   spn   ie11   smd   aar   

原文地址:http://www.cnblogs.com/raorao1994/p/6634899.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!