<?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: Arcade Expressions for Attribute Rule to find angle of a polyline in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047421#M39752</link>
    <description>&lt;P&gt;Looks like it should work...&lt;/P&gt;&lt;P&gt;The error is thrown at line 12, which is one of those (can't tell from your code):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var search = Extent(Buffer($feature, .01, "feet"))
var segment = Clip(line, search)["paths"][0]&lt;/LI-CODE&gt;&lt;P&gt;Try these (separate or in combination):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var search = Extent(Buffer($feature, 0.1, "feet"))  // bigger buffer
var clip_geometry = Clip(Geometry(line), search)  // use Geometry(line)
// test if the clip was successfull and return null (or a specific failure value) if not
// this won't solve the underlying problem, but will stop the error
if(clip_geometry == null) {
  return null  // return -9999
}
var segment = clip_geometry.paths[0]  // .paths instead of ["paths"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Also:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Instead of doing the IsEmpty check before returning, do it at the start of the script, so you can return early.
if(!IsEmpty($feature.ROTATION)) {
  return $feature.ROTATION
}
var lineClass = ...
// ...
return Angle(segment[0], segment[-1])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 06:09:33 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2021-04-15T06:09:33Z</dc:date>
    <item>
      <title>Arcade Expressions for Attribute Rule to find angle of a polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047308#M39742</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make an Attribute Rule in ArcGIS Pro to auto populate a Rotation field for a sanitary flow direction point intersecting with a sanitary main feature class. This way with using the rotation field I can set the symbology rotation to reflect which was the sanitary main is flowing. With the arcade expression below, I keep coming up with the error Arcade Error: Unexpected Null. Any idea on what I am doing wrong? The error is attached and the code is below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Find the first intersecting line from the intersecting class&lt;BR /&gt;var lineClass = FeatureSetByName($datastore, "ssGravityMain", ["objectid"], true)&lt;BR /&gt;var line = First(Intersects(lineClass, $feature))&lt;/P&gt;&lt;P&gt;// If no feature was found, return the original value&lt;BR /&gt;if (line == null)&lt;BR /&gt;{&lt;BR /&gt;return $feature.ROTATION&lt;BR /&gt;}&lt;BR /&gt;// Buffer the point by a small amount to extract the segment&lt;BR /&gt;var search = Extent(Buffer($feature, .01, "feet"))&lt;BR /&gt;var segment = Clip(line, search)["paths"][0]&lt;/P&gt;&lt;P&gt;// Get angle of line using the start and end vertex&lt;BR /&gt;if(isempty($feature.ROTATION)) return Angle(segment[0], segment[-1])&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 21:39:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047308#M39742</guid>
      <dc:creator>GISUSER6</dc:creator>
      <dc:date>2021-04-14T21:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expressions for Attribute Rule to find angle of a polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047421#M39752</link>
      <description>&lt;P&gt;Looks like it should work...&lt;/P&gt;&lt;P&gt;The error is thrown at line 12, which is one of those (can't tell from your code):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var search = Extent(Buffer($feature, .01, "feet"))
var segment = Clip(line, search)["paths"][0]&lt;/LI-CODE&gt;&lt;P&gt;Try these (separate or in combination):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var search = Extent(Buffer($feature, 0.1, "feet"))  // bigger buffer
var clip_geometry = Clip(Geometry(line), search)  // use Geometry(line)
// test if the clip was successfull and return null (or a specific failure value) if not
// this won't solve the underlying problem, but will stop the error
if(clip_geometry == null) {
  return null  // return -9999
}
var segment = clip_geometry.paths[0]  // .paths instead of ["paths"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Also:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Instead of doing the IsEmpty check before returning, do it at the start of the script, so you can return early.
if(!IsEmpty($feature.ROTATION)) {
  return $feature.ROTATION
}
var lineClass = ...
// ...
return Angle(segment[0], segment[-1])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 06:09:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047421#M39752</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-04-15T06:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expressions for Attribute Rule to find angle of a polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047540#M39763</link>
      <description>&lt;P&gt;This worked perfectly! Either way worked for me. Thanks for all of your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anna&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 13:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1047540#M39763</guid>
      <dc:creator>GISUSER6</dc:creator>
      <dc:date>2021-04-15T13:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expressions for Attribute Rule to find angle of a polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1317855#M71998</link>
      <description>&lt;P&gt;I get this error when calculation is done "&lt;SPAN&gt;Edits could not be saved: Cannot convert a value of type 'java.lang.Double' to 'SMALLINT'." is there anyway to add something to the line to truncate what is being pushed to my rotation field "227.47006300882038" Thanks in advance.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;Angle&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;segment&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;segment&lt;/SPAN&gt;&lt;SPAN&gt;[-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;])"&amp;nbsp; ?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 14:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1317855#M71998</guid>
      <dc:creator>GiovanniCalzadilla</dc:creator>
      <dc:date>2023-08-11T14:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expressions for Attribute Rule to find angle of a polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1318019#M72011</link>
      <description>&lt;P&gt;Haven't seen this error before, but it sounds like your field is an integer field?&lt;/P&gt;&lt;P&gt;Try rounding the output:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return Round(Angle(segment[0], segment[-1]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 19:57:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1318019#M72011</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-11T19:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expressions for Attribute Rule to find angle of a polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1320110#M72238</link>
      <description>&lt;P&gt;Thank you, I used it as part of a script to auto rotate asset based on a Line direction and it worked perfectly.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 14:50:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expressions-for-attribute-rule-to-find/m-p/1320110#M72238</guid>
      <dc:creator>GiovanniCalzadilla</dc:creator>
      <dc:date>2023-08-18T14:50:27Z</dc:date>
    </item>
  </channel>
</rss>

