<?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: Data Driven Pages in a Web Map or Specifying Extents for the PrintTask in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636269#M59436</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ultimately this is a working answer.&amp;nbsp; But it makes for a cumbersome solution.&amp;nbsp; The web map that I'm trying to provide functionality similar to data driven pages also includes a UniqueValueRenderer that changes based on a user selection.&amp;nbsp; Creating a new map with the DefinitionExpression, user selected layers, and recreating the UniqueValueRenderer adds to the complexity.&amp;nbsp; And ultimately the user would be provided a collection of one page PDFs or images, when what they ultimately want is one multi page PDF.&lt;/P&gt;&lt;P&gt;For this I think I'm going to have to switch gears and look at a geoprocessor based solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Mar 2016 21:20:49 GMT</pubDate>
    <dc:creator>JoshVan_Kylen</dc:creator>
    <dc:date>2016-03-03T21:20:49Z</dc:date>
    <item>
      <title>Data Driven Pages in a Web Map or Specifying Extents for the PrintTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636264#M59431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are trying to recreate the data driven pages process of ArcMap in a web map application.&amp;nbsp; So far we have a Geoprocessor service that the web map application calls to generate the GridIndex and adds graphics to the map indicating the tiles to be printed.&amp;nbsp;&amp;nbsp; Next we would like to use this collection of extents to send to the PrintTask one at a time, but extents is not an accepted parameter of the PrintTask.&amp;nbsp; &lt;/P&gt;&lt;P&gt;We attempted&amp;nbsp; to set the web map to each set of extents and then send a print request but the loop is too fast for the setExtent method and we end up with multiple prints of the last set of extents.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone else have a solution for producing Data Driven Pages in a web map with ESRI's JS API?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I can tell the possible solutions are:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option A:&lt;/STRONG&gt; Modify the Geoprocessor that generates the Gird index to also either call the Export Web Map Task for each of the extents, or use another method to generate the PDFs and serve them to the user.&amp;nbsp; Better yet if it could combine the collection of PDFs into one multi page PDF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option B:&lt;/STRONG&gt; Reverse engineer the JSON call produced by the PrintTask and loop through the collection of extents and send them to the Export Web Map Task. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be greatly appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2015 22:14:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636264#M59431</guid>
      <dc:creator>JoshVan_Kylen</dc:creator>
      <dc:date>2015-09-01T22:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages in a Web Map or Specifying Extents for the PrintTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636265#M59432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;setExtent is asynchronous so you'll need to define a callback function using the then() method in order to know when the extent has been modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an example that shows how this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var extent = new Extent(-122.68,45.53,-122.45,45.60);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(extent).then(function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("Extent has been set - ready to print");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More details on how this works can be found in this excellent blog post: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/54740" target="_blank"&gt;Keeping Promises&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:03:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636265#M59432</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2021-12-12T03:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages in a Web Map or Specifying Extents for the PrintTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636266#M59433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Helvetica, sans-serif;"&gt;Thank You Kelly, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Helvetica, sans-serif;"&gt;This has to be the correct approach, but after incorporating your suggestion the map is setting and printing only the last tile extent in the collection.&amp;nbsp; But at least it is no longer producing multiple prints of the last extent. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Helvetica, sans-serif;"&gt;The for loop does not wait for the asynchronous setExtent to complete before moving onto the next extent.&lt;SPAN class="apple-converted-space"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Helvetica, sans-serif;"&gt;I've read through the recommended "Keeping Promises" and a few other articles/threads ("&lt;A href="http://stackoverflow.com/questions/24660096/correct-way-to-write-loops-for-promise" rel="nofollow noopener noreferrer" target="_blank"&gt;Correct way to write loops for promise&lt;/A&gt;", "&lt;A href="https://dojotoolkit.org/documentation/tutorials/1.10/promises/" rel="nofollow noopener noreferrer" target="_blank"&gt;Dojo Deferreds and Promises&lt;/A&gt;") but I'm still not crystal clear how to achieve a loop effectively with asynchronous calls.&amp;nbsp; Looks like you can't really use a traditional loop and instead will have to look at restructuring this to chain things together.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: Helvetica, sans-serif;"&gt;Here is the updated function, that sets and prints only the last extent in the collection.&amp;nbsp; Looking at the "Chain it up" example in the "Keeping Promises" article seems like the GridIndexPoint function below should work.&amp;nbsp; But line 8 runs through all of the GridIndexfeatures.length before lines 12 &amp;amp; 13 are written to the console. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridIndexPrint = function () {&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dom.byId("mapBusyIndicatorMessage").innerHTML = "Processing...";&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showMapBusyIndicator();&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("length", GridIndexfeatures.length);&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var f = 0, fl = GridIndexfeatures.length; f &amp;lt; fl; f++) {&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("f", f);&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature = GridIndexfeatures&lt;F&gt;;&lt;/F&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var tmpExtent = new Extent(feature.geometry.getExtent().xmin, feature.geometry.getExtent().ymin, feature.geometry.getExtent().xmax, feature.geometry.getExtent().ymax, new SpatialReference({ wkid: 102100 }));&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theMap.setExtent(tmpExtent).then(function () {&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(f, "Extent has been set - ready to print", tmpExtent);&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("PageNumber: " + feature.attributes.PageNumber, "PageName: " + feature.attributes.PageName);&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Print("PNG8.5x11Land");&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hideMapBusyIndicator();&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:03:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636266#M59433</guid>
      <dc:creator>JoshVan_Kylen</dc:creator>
      <dc:date>2021-12-12T03:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages in a Web Map or Specifying Extents for the PrintTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636267#M59434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have done similar (in Flex) as you describe in Option B..&amp;nbsp; &lt;/P&gt;&lt;P&gt;I believe it was the &lt;A href="https://developers.arcgis.com/javascript/jsapi/printparameters-amd.html"&gt;PrintParamters &lt;/A&gt;map object I just needed to modify. I believe i cloned the map object, updated the properties i needed and then passed it as that as the map parameter&lt;/P&gt;&lt;P&gt;This way the visible map was not really used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Sep 2015 17:03:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636267#M59434</guid>
      <dc:creator>Drew</dc:creator>
      <dc:date>2015-09-03T17:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages in a Web Map or Specifying Extents for the PrintTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636268#M59435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't need to display the map then I think Andrew's approach is the way to go. Here's an example that shows this in action - we create a new map for each extent then use that map with the print task. H&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsbin.com/viyobeheno/edit?html,js,output" title="http://jsbin.com/viyobeheno/edit?html,js,output"&gt;JS Bin - Collaborative JavaScript Debugging&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Sep 2015 22:28:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636268#M59435</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-09-03T22:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages in a Web Map or Specifying Extents for the PrintTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636269#M59436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ultimately this is a working answer.&amp;nbsp; But it makes for a cumbersome solution.&amp;nbsp; The web map that I'm trying to provide functionality similar to data driven pages also includes a UniqueValueRenderer that changes based on a user selection.&amp;nbsp; Creating a new map with the DefinitionExpression, user selected layers, and recreating the UniqueValueRenderer adds to the complexity.&amp;nbsp; And ultimately the user would be provided a collection of one page PDFs or images, when what they ultimately want is one multi page PDF.&lt;/P&gt;&lt;P&gt;For this I think I'm going to have to switch gears and look at a geoprocessor based solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 21:20:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/data-driven-pages-in-a-web-map-or-specifying/m-p/636269#M59436</guid>
      <dc:creator>JoshVan_Kylen</dc:creator>
      <dc:date>2016-03-03T21:20:49Z</dc:date>
    </item>
  </channel>
</rss>

