<?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: Dissolve not dissolving. Syntax help please in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657163#M51134</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stefani:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can start with the below code from the following thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/20158-Creating-a-multipolygon-polygon" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/20158-Creating-a-multipolygon-polygon&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would need to pass in the polygons from your existing shapefile instead of building the polygons from scratch.&amp;nbsp; That would require a loop through the shapefile where you extract the shape of each polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

# Create an Array object for the multi-part feature.
array = arcpy.Array()

# List of lists of coordinates.
partList = [['1.0;1.0','1.0;10.0','10.0;10.0','10.0;1.0'],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ['20.0;20.0','20.0;30.0','30.0;30.0','30.0;20.0'],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ['-20.0;-20.0','-20.0;-30.0','-30.0;-30.0','-30.0;-20.0']]

# For each part, create a sub-array and populate it with
#&amp;nbsp;&amp;nbsp; point objects
for coordList in partList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create an Array object for each part.
&amp;nbsp;&amp;nbsp;&amp;nbsp; sub_array = arcpy.Array()

&amp;nbsp;&amp;nbsp;&amp;nbsp; # For each coordinate set, create a point object and add the x- and
&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp; y-coordinates to the point object, then add the point object
&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp; to the array object.
&amp;nbsp;&amp;nbsp;&amp;nbsp; for coordPair in coordList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x, y = coordPair.split(";")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point(x,y)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sub_array.add(pnt)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add in the first point of the array again to close the polygon boundary
&amp;nbsp;&amp;nbsp;&amp;nbsp; sub_array.add(sub_array.getObject(0))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add the sub-array to the main array
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(sub_array)

# Create a multi-part polygon geometry object using the array object
multiPartPolygon = arcpy.Polygon(array)

# Use the geometry object to create a feature class
arcpy.CopyFeatures_management(multiPartPolygon, "c:/temp/geomTest.shp")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:49:01 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2021-12-12T03:49:01Z</dc:date>
    <item>
      <title>Dissolve not dissolving. Syntax help please</title>
      <link>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657161#M51132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I do not understand why this simple script won't work. I can get it to dissolve in model builder but not from a script that I run from inside the map document. My output results are 4 polygons, just like my input file. I only want one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions? Attached shapefile. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import arcpy module
import arcpy
from arcpy import env

# Local variables:
env.workspace="C:\\Test\\shapefiles"

infeatures = "Multipolys.shp"
outfeatures = "C:\\Test\\shapefiles\\Dissolve.shp"

# Process: Dissolve
arcpy.Dissolve_management(infeatures, outfeatures, "", "", "SINGLE_PART", "DISSOLVE_LINES")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS 10.1 Advanced&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2013 23:47:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657161#M51132</guid>
      <dc:creator>StefaniGermanotta</dc:creator>
      <dc:date>2013-04-12T23:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dissolve not dissolving. Syntax help please</title>
      <link>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657162#M51133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The keyword is your problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You want a single, MULTI_PART polygon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but you are requesting four SINGLE_PART polygons&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and that is what you get&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SINGLE_PART only makes a single feature out of contigious or overlapping polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your four widely seperate polygons will only dissole to themselves.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Apr 2013 11:48:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657162#M51133</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2013-04-15T11:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dissolve not dissolving. Syntax help please</title>
      <link>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657163#M51134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stefani:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can start with the below code from the following thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/20158-Creating-a-multipolygon-polygon" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/20158-Creating-a-multipolygon-polygon&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would need to pass in the polygons from your existing shapefile instead of building the polygons from scratch.&amp;nbsp; That would require a loop through the shapefile where you extract the shape of each polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

# Create an Array object for the multi-part feature.
array = arcpy.Array()

# List of lists of coordinates.
partList = [['1.0;1.0','1.0;10.0','10.0;10.0','10.0;1.0'],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ['20.0;20.0','20.0;30.0','30.0;30.0','30.0;20.0'],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ['-20.0;-20.0','-20.0;-30.0','-30.0;-30.0','-30.0;-20.0']]

# For each part, create a sub-array and populate it with
#&amp;nbsp;&amp;nbsp; point objects
for coordList in partList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create an Array object for each part.
&amp;nbsp;&amp;nbsp;&amp;nbsp; sub_array = arcpy.Array()

&amp;nbsp;&amp;nbsp;&amp;nbsp; # For each coordinate set, create a point object and add the x- and
&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp; y-coordinates to the point object, then add the point object
&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp; to the array object.
&amp;nbsp;&amp;nbsp;&amp;nbsp; for coordPair in coordList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x, y = coordPair.split(";")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point(x,y)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sub_array.add(pnt)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add in the first point of the array again to close the polygon boundary
&amp;nbsp;&amp;nbsp;&amp;nbsp; sub_array.add(sub_array.getObject(0))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add the sub-array to the main array
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(sub_array)

# Create a multi-part polygon geometry object using the array object
multiPartPolygon = arcpy.Polygon(array)

# Use the geometry object to create a feature class
arcpy.CopyFeatures_management(multiPartPolygon, "c:/temp/geomTest.shp")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:49:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dissolve-not-dissolving-syntax-help-please/m-p/657163#M51134</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-12-12T03:49:01Z</dc:date>
    </item>
  </channel>
</rss>

