<?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 Is it possible to use the Sketch Widget with a Webmap Map View? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164110#M77004</link>
    <description>&lt;P&gt;I notice the sketch widget relies on using a GraphicsLayer to display the output of the sketch. My app is pulling in a webmap over having the layers live in the app. Is it possible to still use this widget / add a layer with the webmap set as the map view? Here is the sample I am following and my concept code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=sketch-geometries" target="_self"&gt;Sample Code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My Code:&lt;/P&gt;&lt;P&gt;const webmapId = new URLSearchParams(window.location.search).get("webmap")&lt;BR /&gt;?? "(insert webmap id) ";&lt;/P&gt;&lt;P&gt;const graphicsLayer = new GraphicsLayer();&lt;BR /&gt;&lt;BR /&gt;const map = new WebMap({&lt;BR /&gt;portalItem: {&lt;BR /&gt;id: webmapId&lt;BR /&gt;}&lt;BR /&gt;layers: [graphicsLayer]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt;map,&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;padding: {&lt;BR /&gt;left: 50&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.when(() =&amp;gt; {&lt;BR /&gt;const sketch = new Sketch({&lt;BR /&gt;layer: graphicsLayer,&lt;BR /&gt;view:view,&lt;BR /&gt;//graphi will be selected as soon as it is created&lt;BR /&gt;creationMode: "update"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.ui.add(sketch, "top-right");&lt;BR /&gt;});&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2022 20:31:53 GMT</pubDate>
    <dc:creator>ArianaBernal</dc:creator>
    <dc:date>2022-04-13T20:31:53Z</dc:date>
    <item>
      <title>Is it possible to use the Sketch Widget with a Webmap Map View?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164110#M77004</link>
      <description>&lt;P&gt;I notice the sketch widget relies on using a GraphicsLayer to display the output of the sketch. My app is pulling in a webmap over having the layers live in the app. Is it possible to still use this widget / add a layer with the webmap set as the map view? Here is the sample I am following and my concept code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=sketch-geometries" target="_self"&gt;Sample Code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My Code:&lt;/P&gt;&lt;P&gt;const webmapId = new URLSearchParams(window.location.search).get("webmap")&lt;BR /&gt;?? "(insert webmap id) ";&lt;/P&gt;&lt;P&gt;const graphicsLayer = new GraphicsLayer();&lt;BR /&gt;&lt;BR /&gt;const map = new WebMap({&lt;BR /&gt;portalItem: {&lt;BR /&gt;id: webmapId&lt;BR /&gt;}&lt;BR /&gt;layers: [graphicsLayer]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt;map,&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;padding: {&lt;BR /&gt;left: 50&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.when(() =&amp;gt; {&lt;BR /&gt;const sketch = new Sketch({&lt;BR /&gt;layer: graphicsLayer,&lt;BR /&gt;view:view,&lt;BR /&gt;//graphi will be selected as soon as it is created&lt;BR /&gt;creationMode: "update"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.ui.add(sketch, "top-right");&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 20:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164110#M77004</guid>
      <dc:creator>ArianaBernal</dc:creator>
      <dc:date>2022-04-13T20:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use the Sketch Widget with a Webmap Map View?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164137#M77006</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Yes this is possible, your concept code looks good. Have you tried running it? If you run into any issues let me know your error or share your full code.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 21:10:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164137#M77006</guid>
      <dc:creator>MarkW</dc:creator>
      <dc:date>2022-04-13T21:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use the Sketch Widget with a Webmap Map View?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164400#M77016</link>
      <description>&lt;P&gt;Hey Mark,&lt;/P&gt;&lt;P&gt;Thanks for your response, I tried running it through a debugger and found some minor syntax errors that were stopping it from working. It is up and running now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Here is my working code&lt;/P&gt;&lt;P&gt;//Specify the web map id from AGOL&lt;BR /&gt;const webmapId = new URLSearchParams(window.location.search).get("webmap")&lt;BR /&gt;?? " (insert webmap ID) ";&lt;/P&gt;&lt;P&gt;const graphicsLayer = new GraphicsLayer();&lt;BR /&gt;&lt;BR /&gt;const map = new WebMap({&lt;BR /&gt;portalItem: {&lt;BR /&gt;id: webmapId&lt;BR /&gt;},&lt;BR /&gt;layers: [graphicsLayer]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;padding: {&lt;BR /&gt;left: 50&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.when(() =&amp;gt; {&lt;BR /&gt;const sketch = new Sketch({&lt;BR /&gt;layer: graphicsLayer,&lt;BR /&gt;view:view,&lt;BR /&gt;//graphi will be selected as soon as it is created&lt;BR /&gt;creationMode: "update"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.ui.add(sketch, "top-right");&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 13:55:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-use-the-sketch-widget-with-a/m-p/1164400#M77016</guid>
      <dc:creator>ArianaBernal</dc:creator>
      <dc:date>2022-04-14T13:55:34Z</dc:date>
    </item>
  </channel>
</rss>

