<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>等值线 等值面 GP 调用 demo</title> <link rel="stylesheet" href="http://xxxx/arcgis_js_api/library/4.20/esri/themes/light/main.css"> <script src="http://xxxx/arcgis_js_api/library/4.20/init.js"></script> </head> <style> html, body { width: 100%; height: 100vh; padding: 0; margin: 0; } #mapDiv{ width: 100%; height: 100vh; } </style> <body> <div id='mapDiv'></div> </body> <script> let dzdtUrl = "http://xxxx/arcgis/rest/services/BaseMap/BlueMap2019_2000/MapServer"; require(["esri/Map", "esri/views/MapView", "esri/geometry/SpatialReference", "esri/layers/MapImageLayer", "esri/layers/GraphicsLayer", "esri/geometry/Point", "esri/Graphic", "esri/rest/support/FeatureSet", "esri/tasks/Geoprocessor", "esri/symbols/SimpleLineSymbol", "esri/Color"], function(Map, MapView,SpatialReference,MapImageLayer,GraphicsLayer, Point, Graphic,FeatureSet, Geoprocessor,SimpleLineSymbol,Color){ let tiledLayerDZDT = new MapImageLayer(dzdtUrl, { id: '电子地图' }); let map = new Map({ layers: [tiledLayerDZDT] }); let view = new MapView({ container: "mapDiv", map: map }); let gp = new Geoprocessor("http://xxxx/arcgis/rest/services/WJWATER/Model_dengzhixian/GPServer/Model_dengzhixian"); let graphicLayer = new GraphicsLayer({id:"dengzhixian"}); let markerSymbol = { type: "simple-marker", color: [ 255,0,0,0.5], outline: { color: [ 255,255,255,1], width: "0.5px" } }; let baseSpatialRef = new SpatialReference(4490); //模拟测站点数据 let graphic1 = new Graphic(new Point(120.65150200000005,30.925711000000035,baseSpatialRef),markerSymbol,{"OBJECTID": 1,"stcd": "1","stnm": "盛泽","drp": 330,"x": 120.651502,"y": 30.925711}); let graphic2 = new Graphic(new Point(120.50056400000005,30.828365000000076,baseSpatialRef),markerSymbol,{"OBJECTID": 2,"stcd": "2","stnm": "桃源","drp": 210,"x": 120.500564,"y": 30.828365}); let graphic3 = new Graphic(new Point(120.64674500000001,31.163235000000043,baseSpatialRef),markerSymbol,{"OBJECTID": 3,"stcd": "20","stnm": "松陵内河(西门二站)","drp": 320,"x": 120.646745,"y": 31.163235}); let graphic4 = new Graphic(new Point(120.66083700000001,31.155732000000057,baseSpatialRef),markerSymbol,{"OBJECTID": 4,"stcd": "21","stnm": "松陵外河(运河)","drp": 590,"x": 120.660837,"y": 31.155732}); let graphic5 = new Graphic(new Point(120.59381200000007,31.134543000000065,baseSpatialRef),markerSymbol,{"OBJECTID": 5,"stcd": "22","stnm": "东太湖","drp": 70,"x": 120.593812,"y": 31.134543}); let graphic6 = new Graphic(new Point(120.55207700000005,31.025490000000048,baseSpatialRef),markerSymbol,{"OBJECTID": 6,"stcd": "23","stnm": "开发区","drp": 510,"x": 120.552077,"y": 31.02549}); let graphic7 = new Graphic(new Point(120.55207700000005,31.025490000000048,baseSpatialRef),markerSymbol,{"OBJECTID": 7,"stcd": "23","stnm": "横扇","drp": 300,"x": 120.552077,"y": 31.02549}); let graphic8 = new Graphic(new Point(120.67094400000008,31.106012000000078,baseSpatialRef),markerSymbol,{"OBJECTID": 8,"stcd": "3519","stnm": "南大港闸站","drp": 540,"x": 120.670944,"y": 31.106012}); //用于比对效果 graphicLayer.add(graphic1); graphicLayer.add(graphic2); graphicLayer.add(graphic3); graphicLayer.add(graphic4); graphicLayer.add(graphic5); graphicLayer.add(graphic6); graphicLayer.add(graphic7); graphicLayer.add(graphic8); map.layers.push(graphicLayer); //用于生成等值线的参数 let features = []; features.push(graphic1); features.push(graphic2); features.push(graphic3); features.push(graphic4); features.push(graphic5); features.push(graphic6); features.push(graphic7); features.push(graphic8); let featureset = new FeatureSet(); featureset.features = features; let para = { YL_point:featureset, } let slsymbol = new SimpleLineSymbol(//标识等值线的渲染 SimpleLineSymbol.STYLE_DASH, new Color([255,0,0]),3 ); gp.submitJob(para).then(jobInfo => { gp.waitForJobCompletion(jobInfo.jobId, { interval: 3000 }).then(jobInfo => { gp.getResultData(jobInfo.jobId, "Contour_Idw_YL_1").then(response => { console.log(response); let features = response.value.features; features.forEach( function(item,index,arr){ console.log("item",item,"index",index,"arr",arr); }); }); }); }); }); </script> </html>
正文
arcgis api 4.20请求GP服务
文章版权声明:除非注明,否则均为
譬如朝露_策温技术开发工作室博客原创文章,转载或复制请以超链接形式并注明出处。
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接