<?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: For a polygon with a hole, why both partCount and isMultipart same to 1(True) ? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1328024#M68616</link>
    <description>&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/extensions/data-reviewer/finding-multipart-polygons.htm#:~:text=Multipart%20polygon%20features%20are%20polygons,some%20data%20models%20do%20not." target="_blank"&gt;Finding multipart polygons—ArcMap | Documentation (arcgis.com)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 21:58:40 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2023-09-12T21:58:40Z</dc:date>
    <item>
      <title>For a polygon with a hole, why both partCount and isMultipart same to 1(True) ?</title>
      <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327562#M68586</link>
      <description>&lt;P&gt;As the isMultipart means " True if the count of the geometry's part greater than 1", I think it equals to "partCount &amp;gt; 1", but for a polygon geometry with a hole, isMultipart is True but partCount is 1, so how to understand? thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 01:36:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327562#M68586</guid>
      <dc:creator>pyfans</dc:creator>
      <dc:date>2023-09-12T01:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: For a polygon with a hole, why both partCount and isMultipart same to 1(True) ?</title>
      <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327566#M68587</link>
      <description>&lt;P&gt;From the related links&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/is-a-polygon-with-a-hole-a-multipart-polygon/td-p/327771" target="_blank"&gt;Is a polygon with a hole a multipart polygon? - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 02:08:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327566#M68587</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-09-12T02:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: For a polygon with a hole, why both partCount and isMultipart same to 1(True) ?</title>
      <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327571#M68588</link>
      <description>&lt;P&gt;Thank you, so I should use partCount to judge a shape is a true multi-part geometry, not isMultipart ?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 02:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327571#M68588</guid>
      <dc:creator>pyfans</dc:creator>
      <dc:date>2023-09-12T02:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: For a polygon with a hole, why both partCount and isMultipart same to 1(True) ?</title>
      <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327616#M68590</link>
      <description>&lt;P&gt;To quote esri, for a polygon example&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Multipart polygon features are polygons that contain more than one part or have a hole. For example, if the state of Hawaii was modeled as one feature in the database, it would be a multipart polygon. The geodatabase allows for multipart polygons, but some data models do not.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 07:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327616#M68590</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-09-12T07:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: For a polygon with a hole, why both partCount and isMultipart same to 1(True) ?</title>
      <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327797#M68591</link>
      <description>&lt;P&gt;What are you quoting there, Dan? Because "multi-part" and "multi-ring" get conflated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The rules in the underlying SgShape API are clear: A polygon is defined by one or more (non-self-intersecting) rings.&amp;nbsp; One ring is clearly not multi-part, but an island with a lake (or a county with a contained city) is multi-ring, but still single-part (the underlying API calls internal rings "subparts").&lt;/P&gt;&lt;P&gt;What we have here is two different definitions in the same API (which can happen when three different models are merged):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;arcpy.Polygon.isMultipart&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;method uses the Boolean for "has multiple rings"&lt;/LI&gt;&lt;LI&gt;The &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;arcpy.Polygon.partCount&lt;/FONT&gt;&lt;/STRONG&gt; method uses parts and subparts definition for parts&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

sr = arcpy.SpatialReference(4326)
sr.setFalseOriginAndUnits(-400.0,-400.0,1000)

p1r1_wkt = 'POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0))'
p1r2_wkt = 'POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4))'
p2r2_wkt = 'MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0)), ((5 5, 9 5, 9 9, 5 9, 5 5)))'
p2r3_wkt = 'MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 3 1, 3 3, 1 3, 3 3)), ((5 5, 9 5, 9 9, 5 9, 5 5)))'

for wkt in [p1r1_wkt,p1r2_wkt,p2r2_wkt,p2r3_wkt]:
    geom = arcpy.FromWKT(wkt,sr)

    isMulti   = geom.isMultipart
    partCount = geom.partCount
    ringCount = geom.boundary().partCount
    
    print(f"{wkt}\nMultipart: {isMulti}, Part Count: {partCount}, Ring Count: {ringCount}\n")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0))
Multipart: False, Part Count: 1, Ring Count: 1

POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4))
Multipart: True, Part Count: 1, Ring Count: 2

MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0)), ((5 5, 9 5, 9 9, 5 9, 5 5)))
Multipart: True, Part Count: 2, Ring Count: 2

MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 3 1, 3 3, 1 3, 3 3)), ((5 5, 9 5, 9 9, 5 9, 5 5)))
Multipart: True, Part Count: 2, Ring Count: 3&lt;/LI-CODE&gt;&lt;P&gt;so we can see the dichotomy.&lt;/P&gt;&lt;P&gt;If you want to use the OGC definition of Polygon, then you have to deal with three conditions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Zero rings ("POLYGON EMPTY") [In the Esri lexicon, this is a Nil-type geometry, not a Polygon]&lt;/LI&gt;&lt;LI&gt;One ring&lt;/LI&gt;&lt;LI&gt;One external ring and one or more internal rings&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So, at this point it becomes rote:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;geom.isMultipart&lt;/FONT&gt;&lt;/STRONG&gt; really means "Has multiple rings" and,&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;geom.partCount == 1&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;is really "Is single part?"&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;If you really want to know how many rings are present, use &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;geom.boundary().partCount&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;- V&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 15:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1327797#M68591</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2023-09-12T15:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: For a polygon with a hole, why both partCount and isMultipart same to 1(True) ?</title>
      <link>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1328024#M68616</link>
      <description>&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/extensions/data-reviewer/finding-multipart-polygons.htm#:~:text=Multipart%20polygon%20features%20are%20polygons,some%20data%20models%20do%20not." target="_blank"&gt;Finding multipart polygons—ArcMap | Documentation (arcgis.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:58:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-a-polygon-with-a-hole-why-both-partcount-and/m-p/1328024#M68616</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-09-12T21:58:40Z</dc:date>
    </item>
  </channel>
</rss>

