0

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>

1 Answer 1

1

It seems to be that the url in the following line of code is not available:

var gp = new Geoprocessor("http://iicss63:6080/arcgis/rest/services/NCAOR/XYZtoR/GPServer");

You should try to enter the url in your browser to check if it's reachable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.