<?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: Automatically Resizing Polygons in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097499#M25824</link>
    <description>&lt;P&gt;I did come across this bit of code, which may help:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; math

&lt;SPAN class=""&gt;def&lt;/SPAN&gt; &lt;SPAN class=""&gt;scale_geom&lt;/SPAN&gt;(&lt;SPAN class=""&gt;geom, scale, reference=&lt;SPAN class=""&gt;None&lt;/SPAN&gt;&lt;/SPAN&gt;):
    &lt;SPAN class=""&gt;"""Returns geom scaled to scale %"""&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; geom &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;: &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; reference &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;:
        &lt;SPAN class=""&gt;# we'll use the centroid if no reference point is given&lt;/SPAN&gt;
        reference = geom.centroid

    refgeom = arcpy.PointGeometry(reference)
    newparts = []
    &lt;SPAN class=""&gt;for&lt;/SPAN&gt; pind &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;range&lt;/SPAN&gt;(geom.partCount):
        part = geom.getPart(pind)
        newpart = []
        &lt;SPAN class=""&gt;for&lt;/SPAN&gt; ptind &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;range&lt;/SPAN&gt;(part.count):
            apnt = part.getObject(ptind)
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; apnt &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;:
                &lt;SPAN class=""&gt;# polygon boundaries and holes are all returned in the same part.&lt;/SPAN&gt;
                &lt;SPAN class=""&gt;# A null point separates each ring, so just pass it on to&lt;/SPAN&gt;
                &lt;SPAN class=""&gt;# preserve the holes.&lt;/SPAN&gt;
                newpart.append(apnt)
                &lt;SPAN class=""&gt;continue&lt;/SPAN&gt;
            bdist = refgeom.distanceTo(apnt)

            bpnt = arcpy.Point(reference.X + bdist, reference.Y)
            adist = refgeom.distanceTo(bpnt)
            cdist = arcpy.PointGeometry(apnt).distanceTo(bpnt)

            &lt;SPAN class=""&gt;# Law of Cosines, angle of C given lengths of a, b and c&lt;/SPAN&gt;
            angle = math.acos((adist**&lt;SPAN class=""&gt;2&lt;/SPAN&gt; + bdist**&lt;SPAN class=""&gt;2&lt;/SPAN&gt; - cdist**&lt;SPAN class=""&gt;2&lt;/SPAN&gt;) / (&lt;SPAN class=""&gt;2&lt;/SPAN&gt; * adist * bdist))

            scaledist = bdist * scale

            &lt;SPAN class=""&gt;# If the point is below the reference point then our angle&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;# is actually negative&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; apnt.Y &amp;lt; reference.Y: angle = angle * -&lt;SPAN class=""&gt;1&lt;/SPAN&gt;

            &lt;SPAN class=""&gt;# Create a new point that is scaledist from the origin &lt;/SPAN&gt;
            &lt;SPAN class=""&gt;# along the x axis. Rotate that point the same amount &lt;/SPAN&gt;
            &lt;SPAN class=""&gt;# as the original then translate it to the reference point&lt;/SPAN&gt;
            scalex = scaledist * math.cos(angle) + reference.X
            scaley = scaledist * math.sin(angle) + reference.Y

            newpart.append(arcpy.Point(scalex, scaley))
        newparts.append(newpart)

    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; arcpy.Geometry(geom.&lt;SPAN class=""&gt;type&lt;/SPAN&gt;, arcpy.Array(newparts), geom.spatialReference)&lt;/PRE&gt;&lt;P&gt;You can call it with a geometry object, a scale factor (1 = same size, 0.5 = half size, 5 = 5 times as large, etc.), and an optional reference point:&lt;/P&gt;&lt;PRE&gt;scale_geom(some_geom, &lt;SPAN class=""&gt;1.5&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Referenced from here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/169694/is-there-arcpy-tool-for-polygon-resizing-like-scale-tool-of-advanced-editing-too" target="_blank" rel="noopener"&gt;https://gis.stackexchange.com/questions/169694/is-there-arcpy-tool-for-polygon-resizing-like-scale-tool-of-advanced-editing-too&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Sep 2021 23:54:17 GMT</pubDate>
    <dc:creator>mdonnelly</dc:creator>
    <dc:date>2021-09-12T23:54:17Z</dc:date>
    <item>
      <title>Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1096627#M25813</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently using ArcGIS 10.5. I was wondering if there is a tool that automatically adjusts a polygon to a specified size? Say I start with a triangle of 3 hectares, and I want to increase its area in all directions for it to become 5 hectares automatically, is there a tool that does this? Or a combination of tools perhaps?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 05:34:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1096627#M25813</guid>
      <dc:creator>MShairah</dc:creator>
      <dc:date>2021-09-09T05:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1096635#M25814</link>
      <description>&lt;P&gt;Maybe this is what you could use:&lt;/P&gt;&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/editing-existing-features/scaling-a-feature.htm" target="_blank" rel="noopener"&gt;https://desktop.arcgis.com/en/arcmap/latest/manage-data/editing-existing-features/scaling-a-feature.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/2.6/help/editing/move-or-rotate-or-scale-a-feature.htm#GUID-9E6FCFDA-84A6-4D3B-BDF1-3F248166F554" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/2.6/help/editing/move-or-rotate-or-scale-a-feature.htm#GUID-9E6FCFDA-84A6-4D3B-BDF1-3F248166F554&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 06:17:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1096635#M25814</guid>
      <dc:creator>mdonnelly</dc:creator>
      <dc:date>2021-09-09T06:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1096695#M25815</link>
      <description>&lt;P&gt;Dear Mark,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response!&lt;/P&gt;&lt;P&gt;Although my problem with this tool is that I don't seem to end up with the exact measurement I want. You will see in the first image that the polygon is 0.890589 hectares. I wanted to upscale this to &lt;STRONG&gt;0.9494 hectares&lt;/STRONG&gt;&amp;nbsp;by using 1.06571298 as the Scale Factor. You will see in the next image that I didn't arrive at this and instead got 1.011788.&amp;nbsp; I'm not sure what's happening here but this tool can't seem to help me with what I want to happen. Any other solutions you can suggest?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Before Scale Tool" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22656i8AE1485F6B70D565/image-size/large?v=v2&amp;amp;px=999" role="button" title="Before Scale Tool.png" alt="Before Scale Tool" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Before Scale Tool&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="After Scale Tool" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22657iCB9937A166FD2F6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="After Scale Tool.png" alt="After Scale Tool" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;After Scale Tool&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 11:25:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1096695#M25815</guid>
      <dc:creator>MShairah</dc:creator>
      <dc:date>2021-09-09T11:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097046#M25817</link>
      <description>&lt;P&gt;I am unsure why the tool behaves in that way. It might be worth raising a support ticket to see if there something that can be done.&lt;/P&gt;&lt;P&gt;I cant' think of any other OOTB tools that can help you with your problem. You could probably code something up in Python to do the job though.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 23:28:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097046#M25817</guid>
      <dc:creator>mdonnelly</dc:creator>
      <dc:date>2021-09-09T23:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097111#M25818</link>
      <description>&lt;P&gt;Hello again Mark,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I can bring it up with them. Unfortunately, I don't know enough Python to construct a code that will execute said task. I may have to wait for a response from esri regarding the tool.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your responses&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 08:00:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097111#M25818</guid>
      <dc:creator>MShairah</dc:creator>
      <dc:date>2021-09-10T08:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097499#M25824</link>
      <description>&lt;P&gt;I did come across this bit of code, which may help:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; math

&lt;SPAN class=""&gt;def&lt;/SPAN&gt; &lt;SPAN class=""&gt;scale_geom&lt;/SPAN&gt;(&lt;SPAN class=""&gt;geom, scale, reference=&lt;SPAN class=""&gt;None&lt;/SPAN&gt;&lt;/SPAN&gt;):
    &lt;SPAN class=""&gt;"""Returns geom scaled to scale %"""&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; geom &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;: &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; reference &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;:
        &lt;SPAN class=""&gt;# we'll use the centroid if no reference point is given&lt;/SPAN&gt;
        reference = geom.centroid

    refgeom = arcpy.PointGeometry(reference)
    newparts = []
    &lt;SPAN class=""&gt;for&lt;/SPAN&gt; pind &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;range&lt;/SPAN&gt;(geom.partCount):
        part = geom.getPart(pind)
        newpart = []
        &lt;SPAN class=""&gt;for&lt;/SPAN&gt; ptind &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;range&lt;/SPAN&gt;(part.count):
            apnt = part.getObject(ptind)
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; apnt &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;:
                &lt;SPAN class=""&gt;# polygon boundaries and holes are all returned in the same part.&lt;/SPAN&gt;
                &lt;SPAN class=""&gt;# A null point separates each ring, so just pass it on to&lt;/SPAN&gt;
                &lt;SPAN class=""&gt;# preserve the holes.&lt;/SPAN&gt;
                newpart.append(apnt)
                &lt;SPAN class=""&gt;continue&lt;/SPAN&gt;
            bdist = refgeom.distanceTo(apnt)

            bpnt = arcpy.Point(reference.X + bdist, reference.Y)
            adist = refgeom.distanceTo(bpnt)
            cdist = arcpy.PointGeometry(apnt).distanceTo(bpnt)

            &lt;SPAN class=""&gt;# Law of Cosines, angle of C given lengths of a, b and c&lt;/SPAN&gt;
            angle = math.acos((adist**&lt;SPAN class=""&gt;2&lt;/SPAN&gt; + bdist**&lt;SPAN class=""&gt;2&lt;/SPAN&gt; - cdist**&lt;SPAN class=""&gt;2&lt;/SPAN&gt;) / (&lt;SPAN class=""&gt;2&lt;/SPAN&gt; * adist * bdist))

            scaledist = bdist * scale

            &lt;SPAN class=""&gt;# If the point is below the reference point then our angle&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;# is actually negative&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; apnt.Y &amp;lt; reference.Y: angle = angle * -&lt;SPAN class=""&gt;1&lt;/SPAN&gt;

            &lt;SPAN class=""&gt;# Create a new point that is scaledist from the origin &lt;/SPAN&gt;
            &lt;SPAN class=""&gt;# along the x axis. Rotate that point the same amount &lt;/SPAN&gt;
            &lt;SPAN class=""&gt;# as the original then translate it to the reference point&lt;/SPAN&gt;
            scalex = scaledist * math.cos(angle) + reference.X
            scaley = scaledist * math.sin(angle) + reference.Y

            newpart.append(arcpy.Point(scalex, scaley))
        newparts.append(newpart)

    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; arcpy.Geometry(geom.&lt;SPAN class=""&gt;type&lt;/SPAN&gt;, arcpy.Array(newparts), geom.spatialReference)&lt;/PRE&gt;&lt;P&gt;You can call it with a geometry object, a scale factor (1 = same size, 0.5 = half size, 5 = 5 times as large, etc.), and an optional reference point:&lt;/P&gt;&lt;PRE&gt;scale_geom(some_geom, &lt;SPAN class=""&gt;1.5&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Referenced from here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/169694/is-there-arcpy-tool-for-polygon-resizing-like-scale-tool-of-advanced-editing-too" target="_blank" rel="noopener"&gt;https://gis.stackexchange.com/questions/169694/is-there-arcpy-tool-for-polygon-resizing-like-scale-tool-of-advanced-editing-too&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Sep 2021 23:54:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1097499#M25824</guid>
      <dc:creator>mdonnelly</dc:creator>
      <dc:date>2021-09-12T23:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Resizing Polygons</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1099688#M25846</link>
      <description>&lt;P&gt;Hello Mark!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this, although I've found another workaround (albeit manual) solution for my problem, I'll surely be studying this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 14:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/automatically-resizing-polygons/m-p/1099688#M25846</guid>
      <dc:creator>MShairah</dc:creator>
      <dc:date>2021-09-19T14:55:27Z</dc:date>
    </item>
  </channel>
</rss>

