<?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 restrict the Sketch widget in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-restrict-the-sketch-widget/m-p/1415384#M84417</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to restrict the sketch from sketch widget with the polygon boundary. I'm aware that we can get the geometry with event of click&lt;/P&gt;&lt;P&gt;sketch.on("create, (event) =&amp;gt; {&lt;/P&gt;&lt;P&gt;if(!(geometryEngine.within(event.graphic.geometry, polygon))) {&lt;/P&gt;&lt;P&gt;return;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;but I'm still able to create feature outside the polygon boundary.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2024 17:25:52 GMT</pubDate>
    <dc:creator>SaiPeketi</dc:creator>
    <dc:date>2024-04-25T17:25:52Z</dc:date>
    <item>
      <title>How to restrict the Sketch widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-restrict-the-sketch-widget/m-p/1415384#M84417</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to restrict the sketch from sketch widget with the polygon boundary. I'm aware that we can get the geometry with event of click&lt;/P&gt;&lt;P&gt;sketch.on("create, (event) =&amp;gt; {&lt;/P&gt;&lt;P&gt;if(!(geometryEngine.within(event.graphic.geometry, polygon))) {&lt;/P&gt;&lt;P&gt;return;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;but I'm still able to create feature outside the polygon boundary.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 17:25:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-restrict-the-sketch-widget/m-p/1415384#M84417</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2024-04-25T17:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to restrict the Sketch widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-restrict-the-sketch-widget/m-p/1477183#M84690</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/204563"&gt;@SaiPeketi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get this working by creating a polygon graphic and deleting the sketched graphic when it is not within that polygon. One important note, the default spatial reference for the Sketch widget is 102100, so make sure the boarder polygon has the same spatial reference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the sample I created, hopefully this is helpful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/MarkW1/pen/xxNORZm" target="_blank"&gt;https://codepen.io/MarkW1/pen/xxNORZm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 18:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-restrict-the-sketch-widget/m-p/1477183#M84690</guid>
      <dc:creator>MarkW</dc:creator>
      <dc:date>2024-05-22T18:47:19Z</dc:date>
    </item>
  </channel>
</rss>

