adding of gptool to a basemap.

المشرف العام

Administrator
طاقم الإدارة
Service Area Task html, body, #mapDiv { height: 100%; margin: 0; padding: 0; width: 100%; }

#info { bottom: 20px; color: #444; height: auto; font-family: arial, sans-serif; left: 20px; margin: 5px; padding: 10px; position: absolute; text-align: left; width: 200px; z-index: 40;}

require([ "esri/Color", "esri/map", "esri/graphic", "esri/graphicsUtils", "esri/tasks/Geoprocessor", "esri/tasks/FeatureSet", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/tasks/LinearUnit" ], function(Color, Map, Graphic, graphicsUtils, Geoprocessor, FeatureSet, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol,LinearUnit) {

var map, gp; var bufferDistance = esri.tasks.LinearUnit(); bufferDistance.distance = 500; bufferDistance.units = "esriMeters"; // Initialize map, GP and image params map = new Map("mapDiv", { basemap: "streets", center: [-95.255, 38.96], zoom: 12 }); gp = new Geoprocessor("http://iicss63:6080/arcgis/rest/services/NCAOR/Buffer4326/GPServer/BufModel"); gp.setOutputSpatialReference({wkid: 102100}); map.on("click", computeServiceArea); function computeServiceArea(evt) { map.graphics.clear(); var pointSymbol = new SimpleMarkerSymbol(); pointSymbol.setOutline = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1); pointSymbol.setSize(14); pointSymbol.setColor(new Color([0, 255, 0, 0.25])); var graphic = new Graphic(evt.mapPoint, pointSymbol); map.graphics.add(graphic); var features = []; features.push(graphic); var featureSet = new FeatureSet(); featureSet.features = features; var params = { "Buffer_Distance": bufferDistance ,"Well_Location": featureSet }; //gp.execute(params, getDriveTimePolys); gp.submitJob(params, completeCallback, statusCallback); } function statusCallback(jobInfo) { console.log(jobInfo.jobStatus); } function completeCallback(jobInfo) { console.log("getting data"); gp.getResultData(jobInfo.jobId,"Buff_2_shp", getDriveTimePolys); } function getDriveTimePolys(results, messages) { var features = results.value.features; // add drive time polygons to the map var feature = features[0]; var polySymbolRed = new SimpleFillSymbol(); polySymbolRed.setOutline(new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 0, 0, 0.5]), 1)); polySymbolRed.setColor(new Color([255, 0, 0, 0.7])); feature.setSymbol(polySymbolRed); map.graphics.add(feature); } // get the extent for the drive time polygon graphics and // zoom to the extent of the drive time polygons // map.setExtent(graphicsUtils.graphicsExtent(map.graphics.graphics), true);});





أكثر...
 
أعلى