Hello,
I am trying to print a map using a print service. I have followed the example on the ArcGIS site namely:
Print templates with esri.request | ArcGIS API for JavaScript
However I can't get it to work using a local feature layer.
Can someone please give some advice.
Thanks
Frank
This is what I have done so far:
<SPAN class="pln" style="color: #000000;">parser</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">parse</SPAN><SPAN class="pun" style="color: #145680;">();</SPAN><SPAN class="pln" style="color: #000000;"><BR /><BR /> app</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">printUrl </SPAN><SPAN class="pun" style="color: #145680;">=</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="str" style="color: #800000;"><SPAN>"</SPAN><A class="jive-link-external-small" href="http://aphrodite/arcgis/rest/services/Layout/WSC_LAYOUT1/GPServer/Export%20Web%20Map" rel="nofollow noopener noreferrer" target="_blank">http://aphrodite/arcgis/rest/services/Layout/WSC_LAYOUT1/GPServer/Export%20Web%20Map</A><SPAN>"</SPAN></SPAN><SPAN class="pun" style="color: #145680;">;</SPAN><SPAN class="pln" style="color: #000000;"><BR /><BR /> esri</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">config</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">defaults</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">io</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">corsEnabledServers</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">push</SPAN><SPAN class="pun" style="color: #145680;">(</SPAN><SPAN class="str" style="color: #800000;">"local_server"</SPAN><SPAN class="pun" style="color: #145680;">);</SPAN><SPAN class="pln" style="color: #000000;"><BR /><BR /> app</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">map </SPAN><SPAN class="pun" style="color: #145680;">=</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="kwd" style="color: #8a4a0b;">new</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="typ" style="color: #2b91af;">Map</SPAN><SPAN class="pun" style="color: #145680;">(</SPAN><SPAN class="str" style="color: #800000;">"map"</SPAN><SPAN class="pun" style="color: #145680;">);</SPAN><SPAN class="pln" style="color: #000000;"><BR /><BR /> </SPAN><SPAN class="com" style="color: #868686;">//Base map</SPAN><SPAN class="pln" style="color: #000000;"><BR /> </SPAN><SPAN class="kwd" style="color: #8a4a0b;">var</SPAN><SPAN class="pln" style="color: #000000;"> basemap </SPAN><SPAN class="pun" style="color: #145680;">=</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="kwd" style="color: #8a4a0b;">new</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="typ" style="color: #2b91af;">ArcGISDynamicMapServiceLayer</SPAN><SPAN class="pun" style="color: #145680;">(</SPAN><SPAN class="str" style="color: #800000;"><SPAN>"</SPAN><A class="jive-link-external-small" href="http://local_server/arcgis/rest/services/NAME/Basemap/MapServer/" rel="nofollow noopener noreferrer" target="_blank">http://local_server/arcgis/rest/services/NAME/Basemap/MapServer/</A><SPAN>"</SPAN></SPAN><SPAN class="pun" style="color: #145680;">);</SPAN><SPAN class="pln" style="color: #000000;"><BR /> basemap</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">setVisibleLayers</SPAN><SPAN class="pun" style="color: #145680;">([</SPAN><SPAN class="lit" style="color: #953838;">0</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">1</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">2</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">3</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">4</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">5</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">6</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="lit" style="color: #953838;">7</SPAN><SPAN class="pun" style="color: #145680;">]);</SPAN><SPAN class="pln" style="color: #000000;"><BR /><BR /> app</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">map</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">addLayer</SPAN><SPAN class="pun" style="color: #145680;">(</SPAN><SPAN class="pln" style="color: #000000;">basemap</SPAN><SPAN class="pun" style="color: #145680;">);</SPAN><SPAN class="pln" style="color: #000000;"><BR /><BR /> </SPAN><SPAN class="com" style="color: #868686;">// add graphics for feature</SPAN><SPAN class="pln" style="color: #000000;"><BR /> </SPAN><SPAN class="kwd" style="color: #8a4a0b;">var</SPAN><SPAN class="pln" style="color: #000000;"> url </SPAN><SPAN class="pun" style="color: #145680;">=</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="str" style="color: #800000;"><SPAN>"</SPAN><A class="jive-link-external-small" href="http://local_server/arcgis/rest/services/NAME/NAME/FeatureServer/n" rel="nofollow noopener noreferrer" target="_blank">http://local_server/arcgis/rest/services/NAME/NAME/FeatureServer/n</A><SPAN>"</SPAN></SPAN><SPAN class="pun" style="color: #145680;">;</SPAN><SPAN class="pln" style="color: #000000;"><BR /> </SPAN><SPAN class="kwd" style="color: #8a4a0b;">var</SPAN><SPAN class="pln" style="color: #000000;"> pipeFeatureLayer </SPAN><SPAN class="pun" style="color: #145680;">=</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="kwd" style="color: #8a4a0b;">new</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="typ" style="color: #2b91af;">FeatureLayer</SPAN><SPAN class="pun" style="color: #145680;">(</SPAN><SPAN class="pln" style="color: #000000;">url</SPAN><SPAN class="pun" style="color: #145680;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="pun" style="color: #145680;">{</SPAN><SPAN class="pln" style="color: #000000;"><BR /> </SPAN><SPAN class="str" style="color: #800000;">"mode"</SPAN><SPAN class="pun" style="color: #145680;">:</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="typ" style="color: #2b91af;">FeatureLayer</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">MODE_SNAPSHOT<BR /> </SPAN><SPAN class="pun" style="color: #145680;">});</SPAN><SPAN class="pln" style="color: #000000;"><BR /> app</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">map</SPAN><SPAN class="pun" style="color: #145680;">.</SPAN><SPAN class="pln" style="color: #000000;">addLayer</SPAN><SPAN class="pun" style="color: #145680;">(</SPAN><SPAN class="pln" style="color: #000000;">pipeFeatureLayer</SPAN><SPAN class="pun" style="color: #145680;">);</SPAN>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.