<?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: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59160#M4693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it does seem wrong. This tool has always caught me off guard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Mar 2016 17:55:07 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2016-03-23T17:55:07Z</dc:date>
    <item>
      <title>Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59153#M4686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;SPAN&gt;The help document for ExtractByPolygon (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Farcmap%2F10.3%2Ftools%2Fspatial-analyst-toolbox%2Fextract-by-polygon.htm" rel="nofollow" target="_blank"&gt;http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/extract-by-polygon.htm&lt;/A&gt;&lt;SPAN&gt;) states:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;"A polygon (or polygons) that defines the area of the input raster to be extracted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Each polygon part is a list of vertices defined by Point classes. Optionally a Polygon class can be used to define a list of polygon parts."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;However the tool fails if the parameter is an arcpy.Polygon class. Is a polygon class really supported? It would be much easier than extracting out the points for the polygon part into a new list...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Also, the document seems to indicate that multiple polygons can be used at one time: See the first line of the parameter description and line below clearly shows a list of multiple lists&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;"form of the object is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;[[point(x1,y1), point(x2,y2), point(xn,yn), ..., point(x1,y1)], [point(x'1,y'1), point(x'2,y'2), point(x'n,y'n), ..., point(x'1,y'1)], ...]"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;The tools fails when the list contains multiple lists of points. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Is the documentation wildly incorrect or the tool broken or am I using it correctly?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 16:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59153#M4686</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-03-23T16:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59154#M4687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to construct the polygon properly.&amp;nbsp; See the example at the bottom of this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/polygon.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/polygon.htm"&gt;Polygon—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 16:17:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59154#M4687</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-23T16:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59155#M4688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the response... pretty sure I'm constructing the polygon correctly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. If I use the point list of a single polygon in the extract function, they each work fine... I've verified they are closed (last point = first point) and clockwise drawn.&amp;nbsp; However if I add each point list to a new point list and use that in the extract method, it fails.&amp;nbsp; My multi-polygon list looks very much like the one that's posted in the help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p1 = [&amp;lt;Point (340892.76867, 4635242.58032, #, #)&amp;gt;, &amp;lt;Point (340899.5, 4635249.5, #, #)&amp;gt;, &amp;lt;Point (340914.5, 4635237.5, #, #)&amp;gt;, &amp;lt;Point (340899.5, 4635228.5, #, #)&amp;gt;, &amp;lt;Point (340892.967108, 4635229.68185, #, #)&amp;gt;, &amp;lt;Point (340892.76867, 4635242.58032, #, #)&amp;gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;works fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p2 = [&amp;lt;Point (340929.5, 4635231.5, #, #)&amp;gt;, &amp;lt;Point (340921.409873, 4635224.25788, #, #)&amp;gt;, &amp;lt;Point (340919.557786, 4635238.01624, #, #)&amp;gt;, &amp;lt;Point (340922.6005, 4635244.69699, #, #)&amp;gt;, &amp;lt;Point (340932.985417, 4635244.63084, #, #)&amp;gt;, &amp;lt;Point (340929.5, 4635231.5, #, #)&amp;gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;works fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mp = [p1, p2]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fails&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. As for using the arcpy.Polygon class, I'm retrieving the polygons directly from a feature class so I'm pretty sure they are "constructed correctly".&amp;nbsp; Just to ensure the result of the search cursor in not a proper arcpy.Polygon class, I exported the points to a simple float list and rebuilt the arcpy.Polygon class as described in the help and it still fails.... as either a single or a multiple part.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;Polygon object at 0x3734d4d0[0x3734d440]&amp;gt;&lt;/P&gt;&lt;P&gt;fails&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 16:30:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59155#M4688</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-03-23T16:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59156#M4689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The polygons 1 and 2 are both with point clockwise, constructed according to what is stated in the Help. I have had problems with the ExtractByPolygon in the past when using multipart polygons, but you are using a list of two single part polygons. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are probably better off,&amp;nbsp; when using the &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/extract-by-mask.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/extract-by-mask.htm"&gt;Extract by Mask—Help | ArcGIS for Desktop&lt;/A&gt; which works with a featurelayer. Just create a feature layer based on the polygons and you are good to go. In my experience Maskis more stable than Polygon.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 17:14:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59156#M4689</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-03-23T17:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59157#M4690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True, ExtractByMask is the fallback, but in my production code we're not reading the points/polygons from feature class --- that was just the test code --- so creating the feature class is an expensive disk io or memory operation ... the ExtractByMask tools also causes the cells alignment to change if the raster analysis environment isn't correctly configured so it tends to lead to errors in the overall process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would just be nice to either have the documentation correctly state what works or if the documentation is correct then there's a bug in the tool...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 17:30:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59157#M4690</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-03-23T17:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59158#M4691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't get it to work using a multipart Polygon object, but it does work by simply passing the entire flat list of points. In your case, try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14587547151011553 jive_macro_code jive_text_macro" data-renderedposition="58.906246185302734_7.997159004211426_1332_15" jivemacro_uid="_14587547151011553"&gt;&lt;P&gt;mp = p1+p2&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 17:39:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59158#M4691</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-03-23T17:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59159#M4692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Winner, Winner, Chicken Dinner!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Darren... that's seems wrong but it does work and gets me moving forward ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 17:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59159#M4692</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-03-23T17:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59160#M4693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it does seem wrong. This tool has always caught me off guard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 17:55:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59160#M4693</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-03-23T17:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.sa.ExtractByPolygon doesn't support Polygon class or multiple polygons</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59161#M4694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding a note:&amp;nbsp; The list addition works fine for 2 polygons but if you add a third, it runs but the result is bunk... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p3 = [&amp;lt;Point (340884.5, 4635231.5, #, #)&amp;gt;, &amp;lt;Point (340875.0534, 4635240.9783, #, #)&amp;gt;, &amp;lt;Point (340881.5, 4635249.5, #, #)&amp;gt;, &amp;lt;Point (340890.5, 4635246.5, #, #)&amp;gt;, &amp;lt;Point (340890.5, 4635237.5, #, #)&amp;gt;, &amp;lt;Point (340884.5, 4635231.5, #, #)&amp;gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mp = p1 + p2 + p3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tools executes to completion but result has a "slices" thru the result rather than discrete chunks of cells.&amp;nbsp; I've tried a bunch of different combinations and polygons... two always seems to work, three+ no good... oh well ExtractByMask i guess.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 19:35:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbypolygon-doesn-t-support-polygon/m-p/59161#M4694</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-03-23T19:35:43Z</dc:date>
    </item>
  </channel>
</rss>

