<?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: Return a modified geometry in ArcGIS Arcade Questions</title>
    <link>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603790#M43</link>
    <description>&lt;P&gt;The difference is to determine whether the segment is angled upwards or downwards.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Apr 2025 15:05:19 GMT</pubDate>
    <dc:creator>RPGIS</dc:creator>
    <dc:date>2025-04-08T15:05:19Z</dc:date>
    <item>
      <title>Return a modified geometry</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603428#M41</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am having trouble with the arcade script below being used in an attribute rule that is designed to adjust the building footprints using the code below. It validates, but when it runs, the vertices do not change and I am not sure how to return the modified geometry.&lt;/P&gt;&lt;P&gt;The script below primarily works with rectilinear polygons, and it will be modified later to check and update each segment so that all segments that it enforces collinear and parallel lines.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function GetThirdVertex(NPoint, a, m, d){
    var np = Dictionary( NPoint )
    //console( np )
    // Solve for possible x2 and y2 coordinates
    var deltaX = d / sqrt(1 + pow(m,2))
    var deltaY = m * deltaX

    // Compute the two possible vertices
    if( a &amp;gt; 0 &amp;amp;&amp;amp; a &amp;lt; 180 ){
        np.x =  np.x + deltaX
        np.y = np.y + deltaY
        }
    else{
        np.x =  np.x - deltaX
        np.y = np.y - deltaY
        }
    //console( np )
    // Return an array containing the two possible vertices
    return Point( np )
}

// Function to get unique slopes in the array of points
function ValidateSlopes( InputArray ){
    var Slopes = []
    for( var i=0; i&amp;lt;Count(InputArray)-1; i++ ){
        var A = InputArray[i]
        var B = InputArray[i+1]
        var m = Round((A.x-B.x)/(A.y-B.y),2)
        Push( Slopes, m )
        }
    var ConvertSlopes = {}
    if( Count( Slopes ) % 2==0 ){
        var A = Null; var B = Null
        for( var i=0; i &amp;lt; Count(Slopes) - 1; i++ ){
            if( IsEmpty( A ) &amp;amp;&amp;amp; IsEmpty( B ) ){ A = Slopes[i]; B=Slopes[i+1] }
            else{
                if( A == Slopes[i] &amp;amp;&amp;amp; B != Slopes[i+1] ){ ConvertSlopes[ Text( Slopes[i+1] ) ] = B }
                else if( A != Slopes[i] &amp;amp;&amp;amp; B == Slopes[i+1] ){ ConvertSlopes[ Text( Slopes[i] ) ] = A }
                }
            }
        }
    return ConvertSlopes
    }

function Slope(A,B){ return Round( (A.x-B.x)/(A.y-B.y), 2 ) }

var Geo = Geometry( $feature )
var SR = Geo.spatialReference
var NewRings = []
var Rings = Geo.Rings
for( var R in Rings ){
    var Ring = Array(Rings[ R ])
    var VSlopes = ValidateSlopes(Ring)
    var NewRing = [Ring[0],Ring[0]]
    for (var i = 0; i &amp;lt; Count(Ring) - 1; i++) {
        var p1 = Ring[i]
        var m = Slope( Ring[i], Ring[i+1] )
        if( HasKey( VSlopes, Text(m) ) ){ m = Text(m); m = VSlopes[m] }
        var A = Angle( Ring[0],Ring[1] )
        var d = Round( Distance( Ring[i],Ring[i+1] ), 1 )
        var NewPnt = GetThirdVertex( p1, A, m, d )
        Insert( NewRing , i+1, NewPnt )
        }
    Push( NewRings , NewRing )
    }
Rings = NewRings
// Output adjusted coordinates
var NewGeom = {
    'rings': Rings,
    'hasM': False,
    'hasZ': False,
    'spatialReference': SR
    }
return Geometry( NewGeom )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I have tried several things to modify the existing geometry but still no luck. I did it before but now I cannot seem to remember how exactly I did it.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2025 19:46:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603428#M41</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-04-09T19:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Return a modified geometry</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603742#M42</link>
      <description>&lt;P&gt;I do not see any difference between the then and else clauses in the GetThirdVertex function. Is this intentional?&lt;BR /&gt;&lt;BR /&gt;function GetThirdVertex(NPoint, a, m, d){&lt;BR /&gt;var np = Dictionary( NPoint )&lt;BR /&gt;//console( np )&lt;BR /&gt;// Solve for possible x2 and y2 coordinates&lt;BR /&gt;var deltaX = d / sqrt(1 + pow(m,2))&lt;BR /&gt;var deltaY = m * deltaX&lt;BR /&gt;&lt;BR /&gt;// Compute the two possible vertices&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;if( a &amp;gt; 0 &amp;amp;&amp;amp; a &amp;lt; 180 ){&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;np.x = np.x + deltaX&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;np.y = np.y + deltaY&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;else{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;np.x = np.x + deltaX&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;np.y = np.y + deltaY&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;//console( np )&lt;BR /&gt;// Return an array containing the two possible vertices&lt;BR /&gt;return Point( np )&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 13:59:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603742#M42</guid>
      <dc:creator>VictorGutzler</dc:creator>
      <dc:date>2025-04-08T13:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Return a modified geometry</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603790#M43</link>
      <description>&lt;P&gt;The difference is to determine whether the segment is angled upwards or downwards.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 15:05:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603790#M43</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-04-08T15:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Return a modified geometry</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603807#M44</link>
      <description>I do not see any difference between the then and else clauses in the FindThirdVertex function. Is this intentional?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;function GetThirdVertex(NPoint, a, m, d){&lt;BR /&gt;&lt;BR /&gt;var np = Dictionary( NPoint )&lt;BR /&gt;&lt;BR /&gt;//console( np )&lt;BR /&gt;&lt;BR /&gt;// Solve for possible x2 and y2 coordinates&lt;BR /&gt;&lt;BR /&gt;var deltaX = d / sqrt(1 + pow(m,2))&lt;BR /&gt;&lt;BR /&gt;var deltaY = m * deltaX&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// Compute the two possible vertices&lt;BR /&gt;&lt;BR /&gt;if( a &amp;gt; 0 &amp;amp;&amp;amp; a &amp;lt; 180 ){&lt;BR /&gt;&lt;BR /&gt;np.x = np.x + deltaX&lt;BR /&gt;&lt;BR /&gt;np.y = np.y + deltaY&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else{&lt;BR /&gt;&lt;BR /&gt;np.x = np.x + deltaX&lt;BR /&gt;&lt;BR /&gt;np.y = np.y + deltaY&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//console( np )&lt;BR /&gt;&lt;BR /&gt;// Return an array containing the two possible vertices&lt;BR /&gt;&lt;BR /&gt;return Point( np )&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Apr 2025 15:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603807#M44</guid>
      <dc:creator>VictorGutzler</dc:creator>
      <dc:date>2025-04-08T15:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Return a modified geometry</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603864#M45</link>
      <description>&lt;P&gt;Sorry, it's a typo on my part. It should be subtracting rather than adding for the if else statement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 17:35:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/return-a-modified-geometry/m-p/1603864#M45</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-04-08T17:35:00Z</dc:date>
    </item>
  </channel>
</rss>

