<?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>idea Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset. in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idi-p/1583120</link>
    <description>&lt;P&gt;I feel that the&amp;nbsp;Voronoi partitions (Thiessen Polygons) created using the Create Thiessen Polygons tool would benefit with an added functionality that allows the user to restrict the calculation of the&amp;nbsp;Thiessen Polygons to the boundaries of another dataset (e.g. district boundaries).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thiessen_desired_output_web.jpg" style="width: 901px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124878i8C48829175EE99AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Thiessen_desired_output_web.jpg" alt="Thiessen_desired_output_web.jpg" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Thiessen_desired_output_web.jpg&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Feb 2025 14:50:31 GMT</pubDate>
    <dc:creator>CliveCartwright</dc:creator>
    <dc:date>2025-02-07T14:50:31Z</dc:date>
    <item>
      <title>Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idi-p/1583120</link>
      <description>&lt;P&gt;I feel that the&amp;nbsp;Voronoi partitions (Thiessen Polygons) created using the Create Thiessen Polygons tool would benefit with an added functionality that allows the user to restrict the calculation of the&amp;nbsp;Thiessen Polygons to the boundaries of another dataset (e.g. district boundaries).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thiessen_desired_output_web.jpg" style="width: 901px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124878i8C48829175EE99AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Thiessen_desired_output_web.jpg" alt="Thiessen_desired_output_web.jpg" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Thiessen_desired_output_web.jpg&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 14:50:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idi-p/1583120</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2025-02-07T14:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1583335#M33724</link>
      <description>&lt;P&gt;Good idea.&amp;nbsp; I can see a few use-cases for this.&amp;nbsp; Did you run the second picture as batches and clip?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 21:43:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1583335#M33724</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-02-07T21:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1583533#M33735</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sadly no. I manually mocked it up as helpful visual to get the idea across. But now you've said that, I'm tempted to test my mock by doing just as you've suggested. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 09:48:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1583533#M33735</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2025-02-10T09:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1585635#M33828</link>
      <description>&lt;P&gt;This seems like a useful feature, so I scripted a workaround.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BrennanSmith1_0-1739560172021.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125412i1E4DF6A3E168C837/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BrennanSmith1_0-1739560172021.png" alt="BrennanSmith1_0-1739560172021.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;BrennanSmith1_0-1739560172021.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.env.addOutputsToMap = False
arcpy.env.overwriteOutput = True

# Input feature classes for points and polygon zones. Also the output
boundary_fc = "v_poly"
points_fc   = "v_point"
output_fc   = "v_output"


thiessen_feature_classes = []
# loop through poylgon OIDs
with arcpy.da.SearchCursor(boundary_fc, ["OID@"]) as boundary_cursor:
    for row in boundary_cursor:
        oid = row[0]

        # Create feature layers
        arcpy.management.MakeFeatureLayer(points_fc, "points_lyr")
        arcpy.management.MakeFeatureLayer(boundary_fc, "boundary_lyr")

        # Select the current boundary polygon
        arcpy.SelectLayerByAttribute_management("boundary_lyr", "NEW_SELECTION", f"OBJECTID = {oid}")

        # Select points within the selected boundary polygon
        temp_points_fc = r"memory\temp_points"
        arcpy.SelectLayerByLocation_management("points_lyr", "WITHIN", "boundary_lyr", "", "NEW_SELECTION")
        arcpy.management.CopyFeatures("points_lyr", temp_points_fc)

        # Check if any points were selected
        if int(arcpy.GetCount_management(temp_points_fc).getOutput(0)) &amp;gt; 0:
            # Create intermediate thiessen polygons
            output_thiessen_fc = r"memory\Thiessen_OID_" + str(oid)
            arcpy.env.extent = boundary_fc
            arcpy.analysis.CreateThiessenPolygons(temp_points_fc, output_thiessen_fc)

            # Clip the Thiessen polygons to the boundary
            clipped_thiessen_fc = r"memory\Clipped_Thiessen_OID_" + str(oid) 
            arcpy.analysis.Clip(output_thiessen_fc, "boundary_lyr", clipped_thiessen_fc)

            # Keep a running list of these clipped thiessen polys
            thiessen_feature_classes.append(clipped_thiessen_fc) 
            
        #remove intermediate layers
        arcpy.management.Delete("points_lyr")
        arcpy.management.Delete("boundary_lyr")

# merge them all
if thiessen_feature_classes:
    arcpy.env.addOutputsToMap = True
    arcpy.management.Merge(thiessen_feature_classes, output_fc)
    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 19:10:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1585635#M33828</guid>
      <dc:creator>BrennanSmith1</dc:creator>
      <dc:date>2025-02-14T19:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1585705#M33833</link>
      <description>&lt;P&gt;Very nice.&amp;nbsp; I wonder if it can be faster by taking the&amp;nbsp;arcpy.management.MakeFeatureLayer() out of the cursor for points and boundaries.&amp;nbsp; they might be instantiated in each loop unnecessarily, but could well be misinterpreting!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 20:47:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1585705#M33833</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-02-14T20:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1586395#M33866</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;good idea! I got frustrated when I couldn't get a scipy.spatial.Voronoi approach to work, so I just slapped it together using the GP tools. Here is a slightly optimized approach:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.env.addOutputsToMap = False
arcpy.env.overwriteOutput = True

# Input feature classes for points and polygon zones, and the output polygon. Assuming we're working in a gdb workspace.
boundary_fc = "v_poly"
points_fc   = "v_point"
output_fc   = "v_output"

# create feature layers for selections
points_lyr   = arcpy.management.MakeFeatureLayer(points_fc, "points_lyr")
boundary_lyr = arcpy.management.MakeFeatureLayer(boundary_fc, "boundary_lyr")

# get polygon oids and extent
oid_field = arcpy.Describe(boundary_fc).OIDFieldName
oids = [row[0] for row in arcpy.da.SearchCursor(boundary_fc, ["OID@"])]
arcpy.env.extent = boundary_fc

# empty list of thiessen FCs to merge at the end
thiessen_feature_classes = []

# loop through poylgon OIDs
for oid in oids:
    
    # Select the current boundary polygon
    arcpy.management.SelectLayerByAttribute(boundary_lyr, "NEW_SELECTION", f"{oid_field} = {oid}")

    # Select points within the selected boundary polygon
    arcpy.management.SelectLayerByLocation(points_lyr, "WITHIN", boundary_lyr, "", "NEW_SELECTION")
    
    # Check if any points were selected
    if arcpy.Describe(points_lyr).FIDSet:
        
        # Create intermediate thiessen polygons
        temp_fc = r"memory\Thiessen_OID_" + str(oid)
        arcpy.analysis.CreateThiessenPolygons(points_lyr, temp_fc)

        # Clip the Thiessen polygons to the boundary
        clipped_fc = r"memory\Clipped_Thiessen_OID_" + str(oid) 
        arcpy.analysis.Clip(temp_fc, boundary_lyr, clipped_fc)

        # Keep a running list of these clipped thiessen polys
        thiessen_feature_classes.append(clipped_fc) 
        
#remove intermediate layers
arcpy.management.Delete("points_lyr")
arcpy.management.Delete("boundary_lyr")

# merge them all
if thiessen_feature_classes:
    arcpy.env.addOutputsToMap = True
    arcpy.management.Merge(thiessen_feature_classes, output_fc)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Feb 2025 15:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1586395#M33866</guid>
      <dc:creator>BrennanSmith1</dc:creator>
      <dc:date>2025-02-18T15:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1587028#M33888</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/39515"&gt;@BrennanSmith1&lt;/a&gt;&amp;nbsp;that looks perfect.&amp;nbsp; Just my final recommendations for posterity as I'm sure people will copy your script for future use:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Check if any points were selected
# if arcpy.Describe(points_lyr).FIDSet:
### selectlayerByLocation has a derived output for 
### number of features selected already.  The describe
### operation is quite expensive I think so perhaps this:
layer, count = arcpy.management.SelectLayerByLocation(points_lyr, "WITHIN", boundary_lyr, "", "NEW_SELECTION")

if int(count)&amp;gt;0:

### may sometimes be issues if boundaries have greater extent
### than the points, resulting in a rectangular clip before reaching
### the boundaries.  But this is thinking from ArcMap days, maybe a long
### distant memory in Pro.    

# Set the extent environment using a feature class 
#(can also maybe be set outside loop??)
arcpy.env.extent = boundary_fc   
# Create intermediate thiessen polygons
temp_fc = r"memory\Thiessen_OID_" + str(oid)
arcpy.analysis.CreateThiessenPolygons(points_lyr, temp_fc)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Feb 2025 16:27:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1587028#M33888</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-02-19T16:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Voronoi partitions (Thiessen Polygons) with limited extents from a multi polygon dataset.</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1590666#M33997</link>
      <description>&lt;P&gt;Well done, both of you. It works like a dream!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 14:26:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/voronoi-partitions-thiessen-polygons-with-limited/idc-p/1590666#M33997</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2025-02-28T14:26:51Z</dc:date>
    </item>
  </channel>
</rss>

