<?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: Scale a polygon in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1564743#M12354</link>
    <description>&lt;P&gt;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-GeometryEngine#scale-a-geometry" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-GeometryEngine#scale-a-geometry&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2024 16:36:26 GMT</pubDate>
    <dc:creator>CharlesMacleod</dc:creator>
    <dc:date>2024-12-04T16:36:26Z</dc:date>
    <item>
      <title>Scale a polygon</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1564645#M12353</link>
      <description>&lt;P&gt;I am looking for a way to scale a selected polygon to a specific area.&amp;nbsp; &amp;nbsp;For an example,&amp;nbsp; i have a selected polygon that is 8 acres in size and i want to scale it down to 5 acres without changing the shape of the polygon.&amp;nbsp; So basically expanding or contracting the shape of the polygon.&amp;nbsp; I had done this back in desktop v10.8, but i am having trouble making the conversion to Pro.&amp;nbsp; Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 14:20:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1564645#M12353</guid>
      <dc:creator>mstranovsky</dc:creator>
      <dc:date>2024-12-04T14:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Scale a polygon</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1564743#M12354</link>
      <description>&lt;P&gt;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-GeometryEngine#scale-a-geometry" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-GeometryEngine#scale-a-geometry&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 16:36:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1564743#M12354</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2024-12-04T16:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scale a polygon</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1565684#M12383</link>
      <description>&lt;P&gt;This is how I handles it in Desktop and it worked really well&lt;/P&gt;&lt;P&gt;Public Class ScalePoly&lt;BR /&gt;Inherits ESRI.ArcGIS.Desktop.AddIns.Button&lt;BR /&gt;Public m_pApp As IApplication = My.ArcMap.Application&lt;BR /&gt;Private pDoc As IMxDocument&lt;BR /&gt;Private pMap As IMap&lt;BR /&gt;Private pSelected As IEnumFeature&lt;BR /&gt;Public Sub New()&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;Sub ScaleIt(ByVal pTrans2D As ITransform2D, ByVal dAreaFactor As Double)&lt;BR /&gt;Dim dFactor As Double&lt;BR /&gt;dFactor = dAreaFactor ^ 0.5&lt;BR /&gt;With pTrans2D&lt;BR /&gt;.Scale(GetCentroid(pTrans2D), dFactor, dFactor)&lt;BR /&gt;End With&lt;BR /&gt;End Sub&lt;BR /&gt;Function GetCentroid(ByVal pArea As IArea) As IPoint&lt;BR /&gt;GetCentroid = pArea.Centroid&lt;BR /&gt;End Function&lt;BR /&gt;Protected Overrides Sub OnClick()&lt;BR /&gt;Try&lt;BR /&gt;pDoc = m_pApp.Document&lt;BR /&gt;pMap = pDoc.FocusMap&lt;/P&gt;&lt;P&gt;Dim pActiveView As IActiveView&lt;BR /&gt;pActiveView = pDoc.FocusMap&lt;/P&gt;&lt;P&gt;pSelected = pDoc.FocusMap.FeatureSelection&lt;/P&gt;&lt;P&gt;'Get the selected layer and make sure it's a polygon feature class&lt;BR /&gt;Dim pFClass As IFeatureClass&lt;BR /&gt;Dim featTest As IFeature&lt;BR /&gt;featTest = pSelected.Next&lt;BR /&gt;If featTest Is Nothing Then&lt;BR /&gt;MsgBox("You must select at least one polygon", vbCritical)&lt;BR /&gt;Exit Sub&lt;BR /&gt;Else&lt;BR /&gt;pFClass = featTest.Class&lt;BR /&gt;If Not pFClass.ShapeType = esriGeometryType.esriGeometryPolygon Then&lt;BR /&gt;MsgBox("A Polygon feature must be selected -- please retry")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;'Move the pointer in the set to the top&lt;BR /&gt;pSelected.Reset()&lt;/P&gt;&lt;P&gt;Dim thePoly As IFeature&lt;BR /&gt;Dim pGeo As IGeometry&lt;BR /&gt;Dim theArea As IArea&lt;BR /&gt;Dim dDesiredArea As Double&lt;BR /&gt;Dim dCurrentArea As Double&lt;/P&gt;&lt;P&gt;Dim pArea As IArea&lt;BR /&gt;Dim pOrigin As IPoint&lt;BR /&gt;Dim pTransform As ITransform2D&lt;BR /&gt;Dim scaleValue As String = Nothing&lt;/P&gt;&lt;P&gt;thePoly = pSelected.Next&lt;BR /&gt;Do Until thePoly Is Nothing&lt;/P&gt;&lt;P&gt;pGeo = thePoly.Shape&lt;BR /&gt;theArea = thePoly.Shape&lt;/P&gt;&lt;P&gt;dCurrentArea = theArea.Area&lt;BR /&gt;Dim cbx2 = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID(Of ScalePolyCombo)(My.ThisAddIn.IDs.ScalePolyCombo)&lt;BR /&gt;cbx2.GetACValue(scaleValue)&lt;BR /&gt;If Not scaleValue = "" Then&lt;BR /&gt;dDesiredArea = Convert.ToDouble(scaleValue) * 43560&lt;BR /&gt;Else&lt;BR /&gt;MsgBox("Please enter a valid acreage value to scale polygon to")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;If dDesiredArea &amp;lt; 1 Then&lt;BR /&gt;MsgBox("dDesiredArea is &amp;lt; 1")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;ScaleIt(thePoly.Shape, dDesiredArea / dCurrentArea)&lt;/P&gt;&lt;P&gt;pArea = thePoly.Shape&lt;BR /&gt;pOrigin = pArea.Centroid&lt;BR /&gt;pTransform = thePoly.Shape&lt;BR /&gt;pTransform.Move(1, 1)&lt;BR /&gt;pGeo = pTransform&lt;BR /&gt;pGeo.SpatialReference = pMap.SpatialReference&lt;/P&gt;&lt;P&gt;thePoly.Shape = pGeo&lt;BR /&gt;thePoly.Store()&lt;/P&gt;&lt;P&gt;thePoly = pSelected.Next&lt;BR /&gt;Loop&lt;/P&gt;&lt;P&gt;'refresh the map display&lt;BR /&gt;pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, Nothing, Nothing)&lt;BR /&gt;pActiveView.Refresh()&lt;/P&gt;&lt;P&gt;'release obj's&lt;BR /&gt;scaleValue = Nothing&lt;BR /&gt;theArea = Nothing&lt;BR /&gt;thePoly = Nothing&lt;BR /&gt;dCurrentArea = 0&lt;BR /&gt;dDesiredArea = 0&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;MsgBox(ex.ToString)&lt;BR /&gt;Exit Sub&lt;BR /&gt;End Try&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Protected Overrides Sub OnUpdate()&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;End Class&lt;/P&gt;&lt;P&gt;But i can't seem to make the conversion to Pro because a cannot find the equivalent for the ITransform2D in Pro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 16:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/scale-a-polygon/m-p/1565684#M12383</guid>
      <dc:creator>mstranovsky</dc:creator>
      <dc:date>2024-12-06T16:43:06Z</dc:date>
    </item>
  </channel>
</rss>

