<?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 Generating a Centroid in a feature layer when a Polygon is added to separate feature layer. in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/generating-a-centroid-in-a-feature-layer-when-a/m-p/1561758#M1639</link>
    <description>&lt;P&gt;I am trying to generate a centroid in a feature layer when a propertyID is added to a polygon feature layer. I have it set to update.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;P&gt;// Check if the PropertyID is entered (not null)&lt;BR /&gt;if ($feature.PropertyID != null) {&lt;BR /&gt;&lt;BR /&gt;// Calculate the centroid of the polygon (point location)&lt;BR /&gt;var centroidPoint = centroid($feature);&lt;BR /&gt;&lt;BR /&gt;// Ensure the centroid was successfully calculated&lt;BR /&gt;if (centroidPoint != null) {&lt;BR /&gt;return {&lt;BR /&gt;// Define the edit operation to create the point in the other feature class&lt;BR /&gt;"edit": [&lt;BR /&gt;{&lt;BR /&gt;// Specify the target feature class where the point will be created&lt;BR /&gt;"className": "Test_Points", // Ensure this matches the name of the point feature class&lt;BR /&gt;&lt;BR /&gt;// Define the adds operation for inserting a new point feature&lt;BR /&gt;"adds": [&lt;BR /&gt;{&lt;BR /&gt;// Specify the attributes for the new point feature&lt;BR /&gt;"attributes": {&lt;BR /&gt;"PropertyID": $feature.PropertyID, // Use the PropertyID from the polygon&lt;BR /&gt;"PropertyName": $feature.PropertyName // Use other attributes if necessary&lt;BR /&gt;},&lt;BR /&gt;&lt;BR /&gt;// Use the calculated centroid geometry for the new point&lt;BR /&gt;"geometry": centroidPoint&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;};&lt;BR /&gt;} else {&lt;BR /&gt;// Return an error if the centroid could not be calculated&lt;BR /&gt;return {&lt;BR /&gt;"error": "Centroid calculation failed."&lt;BR /&gt;};&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;// No PropertyID entered, so no point is created&lt;BR /&gt;return {};&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I keep getting this error message, only when the PropertyID is added does this message appear.:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update table row failed.&lt;BR /&gt;The Geometry has no Z values [&lt;BR /&gt;Rule name: New Point,&lt;BR /&gt;Triggering event: Update,&lt;BR /&gt;Class name: Test_Polygons,&lt;BR /&gt;GlobalID: {8036C9B8-FA66-4018-AD39-79E075D7C1EA}]The Geometry has no Z values&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2024 16:27:27 GMT</pubDate>
    <dc:creator>Skysurfer</dc:creator>
    <dc:date>2024-11-22T16:27:27Z</dc:date>
    <item>
      <title>Generating a Centroid in a feature layer when a Polygon is added to separate feature layer.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/generating-a-centroid-in-a-feature-layer-when-a/m-p/1561758#M1639</link>
      <description>&lt;P&gt;I am trying to generate a centroid in a feature layer when a propertyID is added to a polygon feature layer. I have it set to update.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;P&gt;// Check if the PropertyID is entered (not null)&lt;BR /&gt;if ($feature.PropertyID != null) {&lt;BR /&gt;&lt;BR /&gt;// Calculate the centroid of the polygon (point location)&lt;BR /&gt;var centroidPoint = centroid($feature);&lt;BR /&gt;&lt;BR /&gt;// Ensure the centroid was successfully calculated&lt;BR /&gt;if (centroidPoint != null) {&lt;BR /&gt;return {&lt;BR /&gt;// Define the edit operation to create the point in the other feature class&lt;BR /&gt;"edit": [&lt;BR /&gt;{&lt;BR /&gt;// Specify the target feature class where the point will be created&lt;BR /&gt;"className": "Test_Points", // Ensure this matches the name of the point feature class&lt;BR /&gt;&lt;BR /&gt;// Define the adds operation for inserting a new point feature&lt;BR /&gt;"adds": [&lt;BR /&gt;{&lt;BR /&gt;// Specify the attributes for the new point feature&lt;BR /&gt;"attributes": {&lt;BR /&gt;"PropertyID": $feature.PropertyID, // Use the PropertyID from the polygon&lt;BR /&gt;"PropertyName": $feature.PropertyName // Use other attributes if necessary&lt;BR /&gt;},&lt;BR /&gt;&lt;BR /&gt;// Use the calculated centroid geometry for the new point&lt;BR /&gt;"geometry": centroidPoint&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;};&lt;BR /&gt;} else {&lt;BR /&gt;// Return an error if the centroid could not be calculated&lt;BR /&gt;return {&lt;BR /&gt;"error": "Centroid calculation failed."&lt;BR /&gt;};&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;// No PropertyID entered, so no point is created&lt;BR /&gt;return {};&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I keep getting this error message, only when the PropertyID is added does this message appear.:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update table row failed.&lt;BR /&gt;The Geometry has no Z values [&lt;BR /&gt;Rule name: New Point,&lt;BR /&gt;Triggering event: Update,&lt;BR /&gt;Class name: Test_Polygons,&lt;BR /&gt;GlobalID: {8036C9B8-FA66-4018-AD39-79E075D7C1EA}]The Geometry has no Z values&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 16:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/generating-a-centroid-in-a-feature-layer-when-a/m-p/1561758#M1639</guid>
      <dc:creator>Skysurfer</dc:creator>
      <dc:date>2024-11-22T16:27:27Z</dc:date>
    </item>
  </channel>
</rss>

