<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Geoprocessing with JS API 4.0 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270673#M24905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this. I tested it and it works: &lt;/P&gt;&lt;P&gt;function drawResultData(result) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(result);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var resultLayer = gp.getResultImageLayer(result.jobId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.layers.add(resultLayer);&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jun 2016 20:53:18 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2016-06-14T20:53:18Z</dc:date>
    <item>
      <title>Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270668#M24900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having trouble figuring out how to call an asynchronous geoprocessing service with the new 4.0 API.&amp;nbsp; I have looked at the example for calling the sychronous service, but I didn't see any examples for an asynchronous service.&amp;nbsp; I understand that it requires using a "promise", which I am trying to learn to use, and it appears that I have to use "getResultImageLayer()" or "getResultImage()", but I don't understand what I would use for the parameters "resultName" and "imageParams".&amp;nbsp; In the 3.x API, I had to use the URL for the MapServer of the asynchronous service along with the JobId, which would return the result as a layer.&amp;nbsp;&amp;nbsp; I guess I am just confused how this now works in the 4.0 API.&amp;nbsp; I wish there was an example of using an asychronous service.&amp;nbsp;&amp;nbsp; Does anyone know of any examples?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Abby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 16:08:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270668#M24900</guid>
      <dc:creator>AbbyGallegos</dc:creator>
      <dc:date>2016-06-13T16:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270669#M24901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;As you have mentioned &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Geoprocessor.html#submitJob"&gt;submiJob()&lt;/A&gt; returns an instance of promise and it takes 3 arguments:&lt;/P&gt;&lt;P&gt;'callback'- the function called when the promise is resolved&lt;/P&gt;&lt;P&gt;'errback', - the function called when the promise is rejected. &lt;/P&gt;&lt;P&gt;'progback' - the function called when the promise has progress. &lt;/P&gt;&lt;P&gt;More about Promise check &lt;A href="http://dojotoolkit.org/reference-guide/1.10/dojo/promise/Promise.html"&gt;this document&lt;/A&gt;​.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you can run a geoprocessing service asynchronously as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//gp params as required&amp;nbsp; &lt;SPAN style="color: #222222; font-family: Merriweather, serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var params = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "in_features": featureSet,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "material_type": "Chlorine"&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;//run gp service&lt;/P&gt;&lt;P&gt;gp.submitJob(params).then(gpResultData, errBack, progTest);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// This function is called when gp resolves successfully&lt;/P&gt;&lt;P&gt;// result contains GP service result&lt;/P&gt;&lt;P&gt;function gpResultData(result) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log(result);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// This function is called if gp service is rejected&lt;/P&gt;&lt;P&gt;function errBack(err){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("gp error: ", err);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//use this function to check on the progress of gp service&lt;/P&gt;&lt;P&gt;function progTest(value){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; console.log(value.jobStatus);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; console.log(value);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:46:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270669#M24901</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2016-06-13T18:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270670#M24902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Undral for the reply, but I am still a bit confused on how to call "getResultImageLayer" to display the result on the map.&amp;nbsp; Also, I am getting an error that I don't understand when trying to create a new "ImageParameters()".&amp;nbsp; See attached code.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Abby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 21:13:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270670#M24902</guid>
      <dc:creator>AbbyGallegos</dc:creator>
      <dc:date>2016-06-13T21:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270671#M24903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I deleted last message because I failed to understand your issue. I have not tried it myself but pass in null for the ImageParameters when calling getResultImageLayer. I will test it here shortly. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 16:38:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270671#M24903</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2016-06-14T16:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270672#M24904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Undral, you stated that I should be able to access the results of my GP service from the result object.&amp;nbsp; The output of the service that I am trying to access has a Data Type = GPRasterDataLayer.&amp;nbsp; When I was using the 3.x API, I was able to just instantiate a new ArcGISDynamicMapServiceLayer with the MapService URL and the jobId appended to it, then add the layer to the map.&amp;nbsp; It worked in 3.16 API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am now using the 4.0 API with 3D, and I do see the result object in the console.log(result), but I am confused as to how to add it to the map for display.&amp;nbsp; The job succeeds and within the result object I see a "results" with "Viewer_Viewshed" (the data layer I am trying to display).&amp;nbsp; However, I don't know how to add it to the map to display it in my 3D view.&amp;nbsp; This is the code I am using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function drawResult(result) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(result);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var gpMapServiceURL = gpMapUrl + "/" + result.jobId;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // get the url to the MapService with the JobId&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var resultImage = new MapImageLayer({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: gpMapServiceURL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.add(resultImage);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Not able to see the result on the map&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="gpResult.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/207733_gpResult.PNG" style="height: 212px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;I get no errors (using Firebug in firefox), but the result image does not show up on the map.&amp;nbsp; By the way, it does work using 3.16 API.&lt;/P&gt;&lt;P&gt;I really appreciate your help.&amp;nbsp; I would like to get this to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Abby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 19:25:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270672#M24904</guid>
      <dc:creator>AbbyGallegos</dc:creator>
      <dc:date>2016-06-14T19:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270673#M24905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this. I tested it and it works: &lt;/P&gt;&lt;P&gt;function drawResultData(result) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(result);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var resultLayer = gp.getResultImageLayer(result.jobId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.layers.add(resultLayer);&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 20:53:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270673#M24905</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2016-06-14T20:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing with JS API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270674#M24906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awsome, thanks Undral, this works for what I needed.&lt;/P&gt;&lt;P&gt;I really appreciate your help!&lt;/P&gt;&lt;P&gt;Abby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:32:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geoprocessing-with-js-api-4-0/m-p/270674#M24906</guid>
      <dc:creator>AbbyGallegos</dc:creator>
      <dc:date>2016-06-15T15:32:05Z</dc:date>
    </item>
  </channel>
</rss>

