I am trying to get a buffer circle on my map,when I click on map. I tried with the following code, but I got error:
dojo.io.script error Error: Invalid URL
How can I avoid this error?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Simple Map</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="http://js.arcgis.com/3.14/"></script>
<script>
var map;
require([ "esri/map",
"dojo/on",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/ImageParameters",
"esri/tasks/Geoprocessor",
"esri/tasks/FeatureSet",
"dojo/dom",
"dojo/domReady!"], function(Map,on,ArcGISDynamicMapServiceLayer,ImageParameters,Geoprocessor,FeatureSet,dom) {
map = new Map("map", {
basemap: "streets",
center: [72, 25.75],
zoom: 5
});
var imageParameters = new ImageParameters();
imageParameters.format = "PNG24";
var gp = new Geoprocessor("http://iicss63:6080/arcgis/rest/services/NCAOR/XYZtoR/GPServer");
map.on("click", createBuffer);
function createBuffer(){
var params = {"InputFile":FeatureSet,
"BUFFER_30_shp":FeatureSet}
gp.submitJob(params, completeCallback, statusCallback);
};
function completeCallback(jobInfo) {
console.log("getting data");
gp.getResultData(jobInfo.jobId, displayResult);
}
function displayResult(result, messages) {
var simpleLineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255,255,0]), 1);
var features = result.value.features;
for (var f=0, fl=features.length; f<fl; f++) {
var feature = features[f];
feature.setSymbol(simpleLineSymbol);
map.graphics.add(feature);
}
}
function statusCallback(jobInfo) {
console.log(jobInfo.jobStatus);
}
});
</script>
</head>
<body>
<div id="map">
<span id="xyco" style="position:absolute; left:15px; bottom:5px; color:#000; z-index:50;"></span>
</div>
</body>
</html>