<?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 How to get generate WebJSON from map with JSAPI 4 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-generate-webjson-from-map-with-jsapi-4/m-p/1012487#M71207</link>
    <description>&lt;P&gt;I'm trying to create a custom print tool. I'm pretty close to achieving this. I hit a road block and need some help. This is&amp;nbsp; long shot and can't seem to find to much info on this topic with JSAPI 4x. There is some discussion on this with JSAPI 3x.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create the JSON for the webmap. Reading the documentation it says it's easy to do but I see nothing about it, which is frustrating. I've seen people talk about some hidden methods called&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;printTask._getPrintDefinition(myMap,MyPrintParams)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript/get-the-webmap-from-javascript-api-esri-map/td-p/292638&amp;nbsp;" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-api-for-javascript/get-the-webmap-from-javascript-api-esri-map/td-p/292638&amp;nbsp;&lt;/A&gt; &amp;nbsp; &amp;nbsp;This thread is the closest I've seen. It looks like it works for the JSAPI 3x but no mention of 4x. I've tried with both map and view for the first arg in the&amp;nbsp;_getPrintDefinition. I keep getting this error&amp;nbsp;PrintTask.js:formatted:602 Uncaught (in promise) TypeError: Cannot read property 'spatialReference' of undefined&lt;BR /&gt;at g.m._getPrintDefinition (PrintTask.js:formatted:602) (see image attached)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;So my question is how do you grab&amp;nbsp; the Web_Map_asJSON object. According to ESRI's documentation it says it's easily done with the JS API but I see no clear way to do this ?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdamArcichowski_0-1609175708374.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/2907i32A9BC712D1CCBBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdamArcichowski_0-1609175708374.png" alt="AdamArcichowski_0-1609175708374.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;            $('#locationSel').html(output.join(''))
            const printTask = new PrintTask({
            url: printUrl
            });

            const template = new PrintTemplate({
                format: "pdf",
                exportOptions: {
                    dpi: 300
                },
                layout: "a4-portrait",
                layoutOptions: {
                    titleText: "Warren Wilson College Trees",
                    authorText: "Sam"
                }
                });

            const params = new PrintParameters({
                template: template,
                view: view,
                });

            console.log(printTask) 
                
            printTask.execute(params).then(printResult);


            var Web_Map_as_JSON =  printTask._getPrintDefinition(webmap,params);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Dec 2020 17:31:17 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-12-28T17:31:17Z</dc:date>
    <item>
      <title>How to get generate WebJSON from map with JSAPI 4</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-generate-webjson-from-map-with-jsapi-4/m-p/1012487#M71207</link>
      <description>&lt;P&gt;I'm trying to create a custom print tool. I'm pretty close to achieving this. I hit a road block and need some help. This is&amp;nbsp; long shot and can't seem to find to much info on this topic with JSAPI 4x. There is some discussion on this with JSAPI 3x.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create the JSON for the webmap. Reading the documentation it says it's easy to do but I see nothing about it, which is frustrating. I've seen people talk about some hidden methods called&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;printTask._getPrintDefinition(myMap,MyPrintParams)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript/get-the-webmap-from-javascript-api-esri-map/td-p/292638&amp;nbsp;" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-api-for-javascript/get-the-webmap-from-javascript-api-esri-map/td-p/292638&amp;nbsp;&lt;/A&gt; &amp;nbsp; &amp;nbsp;This thread is the closest I've seen. It looks like it works for the JSAPI 3x but no mention of 4x. I've tried with both map and view for the first arg in the&amp;nbsp;_getPrintDefinition. I keep getting this error&amp;nbsp;PrintTask.js:formatted:602 Uncaught (in promise) TypeError: Cannot read property 'spatialReference' of undefined&lt;BR /&gt;at g.m._getPrintDefinition (PrintTask.js:formatted:602) (see image attached)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;So my question is how do you grab&amp;nbsp; the Web_Map_asJSON object. According to ESRI's documentation it says it's easily done with the JS API but I see no clear way to do this ?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdamArcichowski_0-1609175708374.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/2907i32A9BC712D1CCBBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdamArcichowski_0-1609175708374.png" alt="AdamArcichowski_0-1609175708374.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;            $('#locationSel').html(output.join(''))
            const printTask = new PrintTask({
            url: printUrl
            });

            const template = new PrintTemplate({
                format: "pdf",
                exportOptions: {
                    dpi: 300
                },
                layout: "a4-portrait",
                layoutOptions: {
                    titleText: "Warren Wilson College Trees",
                    authorText: "Sam"
                }
                });

            const params = new PrintParameters({
                template: template,
                view: view,
                });

            console.log(printTask) 
                
            printTask.execute(params).then(printResult);


            var Web_Map_as_JSON =  printTask._getPrintDefinition(webmap,params);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 17:31:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-generate-webjson-from-map-with-jsapi-4/m-p/1012487#M71207</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-12-28T17:31:17Z</dc:date>
    </item>
  </channel>
</rss>

