<?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: Default COGO labeling expressions - getting COGO ERROR label in ArcGIS Parcel Fabric Questions</title>
    <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583528#M1892</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/103122"&gt;@RobertChaney&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A "COGO Error" is returned when there are too many parameters. For example, if Direction, Distance, and Radius are all populated.&lt;BR /&gt;It looks like the conversion is placing a zero ('0') if the original value is NULL, instead of keeping it empty.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This can be solved by checking and only converting the units if the attribute is not empty:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AmirBarMaor_0-1739178740962.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124986iAAA64C7FBF8A162E/image-size/large?v=v2&amp;amp;px=999" role="button" title="AmirBarMaor_0-1739178740962.png" alt="AmirBarMaor_0-1739178740962.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (!IsEmpty($feature.Distance)) cogo_distance = cogo_distance*3.28084;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add this check for any value that you convert (distance, radius, arclength, radius2)&lt;/P&gt;&lt;P&gt;Please let us know if this solves the issue&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2025 09:14:29 GMT</pubDate>
    <dc:creator>AmirBar-Maor</dc:creator>
    <dc:date>2025-02-10T09:14:29Z</dc:date>
    <item>
      <title>Default COGO labeling expressions - getting COGO ERROR label</title>
      <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583341#M1891</link>
      <description>&lt;P&gt;I have a parcel fabric where the COGO field values are in meters.&amp;nbsp; I'm able to modify the Default COGO label expression: var cogo_distance = $feature.Distance * 3.28084;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertChaney_0-1738963941666.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124949iD44F3C09A11C69FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertChaney_0-1738963941666.png" alt="RobertChaney_0-1738963941666.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Which gives me the proper label in feet.&amp;nbsp; However, for lines with values in the ArcLength field, the COGO ERROR label shows.&amp;nbsp; When I attempt to change the variable in the default COGO expression to the following:&lt;/P&gt;&lt;P&gt;var cogo_arclength = $feature.ArcLength * 3.28084;&lt;/P&gt;&lt;P&gt;I get COGO ERROR labels on all lines.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertChaney_1-1738964159759.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124950i0CFF4D249F9258F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertChaney_1-1738964159759.png" alt="RobertChaney_1-1738964159759.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I take off the conversion for the Distance field, the ArcLength shows properly, but of course the Distance field shows the COGO ERROR.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertChaney_2-1738964255427.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124951iCEC333BF31FCB7F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertChaney_2-1738964255427.png" alt="RobertChaney_2-1738964255427.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can anyone help point out where I need to further modify the expression to get both fields to show properly in feet?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;Pro ver. 3.3.1&lt;/P&gt;&lt;P&gt;geodatabase is fgdb&lt;/P&gt;&lt;P&gt;Parcel Fabric ver. 5&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Change the settings portion to configure direction format, color, rounding and abbreviations
// This is an Arcade expression

// SETTINGS
var ShowDistance = true;   //set as 'true' to show distance
var ShowDirection = false;  //set as 'true' to show direction
var DirectionType = 1; // 1 = Quadrant Bearing; 2 = North Azimuth; 3 = South Azimuth
var ShowRadius = false;     //set as 'true' to show radius
var ShowCurveParameter = true;    //set as 'true' to show a curve parameter
var ShowCOGOType = true;  //set as 'true' to show prefixes and postfixes defined below for each cogo line label
var COGOType_Entered = ['', ''] //Change prefix and postfix for Entered courses
var COGOType_Computed = ['±', '']  //Change prefix and postfix for Computed courses
var COGOType_FromGeom = ['&amp;amp;lt;', '&amp;gt;'] //Change for prefix and postfix From Geometry courses. The &amp;amp;lt; is a special character to represent the left angle bracket
var CurveParameter = "ArcLength"; //set as 'ArcLength' or 'Chord' or 'Angle' for central angle. Case sensitive!
var ErrorString = "COGO ERROR";   //set to display invalid COGO combinations
var RadiusAbbr = 'R=';     //radius abbreviation
var Radius2Abbr = 'R2=';     //radius2 abbreviation for spiral curves
var ArclengthAbrr = '';  //arclength abbreviation
var ChordAbbr = 'C=';      //chord abbreviation
var AngleAbbr = 'A=';      //central Angle abbreviation
var DistUnitRounding = 2;  //number of decimal places for distance units: distance, radius, arclength &amp;amp; chord
var NumberFormat = "#,###.00" //number format. In this example: thousands separator with padding of 2 zeros 
var directionColor = "blue='255'"; //direction color: red, green, blue, cyan, magenta, yellow, black. You can also use RGB or CYMK combinations.
var distanceColor = "black='255'"; //distance color: red, green, blue, cyan, magenta, yellow, black. You can also use RGB or CYMK combinations.
var radiusColor = "blue='255'";    //radius color:  red, green, blue, cyan, magenta, yellow, black. You can also use RGB or CYMK combinations.
var curveParamColor = "black='255'"; //curve parameter color:  red, green, blue, cyan, magenta, yellow, black. You can also use RGB or CYMK combinations.
var partialCOGOColor = "magenta='255'"; //partial COGO color: red, green, blue, cyan, magenta, yellow, black. You can also use RGB or CYMK combinations.
var invalidCOGOColor = "red='255'"; //invalid COGO color: red, green, blue, cyan, magenta, yellow, black. You can also use RGB or CYMK combinations.
var fontNameSize = "&amp;lt;FNT name = 'Arial' size = '10'&amp;gt;"; //font type and size

// VARIABLES
var cogo_direction = $feature.Direction;
var cogo_distance = $feature.Distance * 3.28084;
var cogo_radius = $feature.Radius;
var cogo_arclength = $feature.ArcLength * 3.28084;
var cogo_radius2 = $feature.Radius2
var cogotype = $feature.COGOType
if (HasKey($feature, "labelPosition")){
   var labelPosition = $feature.labelPosition
}
else {
   var labelPosition = 1
}
var binaryDictionary; //binary dictionary to check COGO combinations
var checksum = 0; //initialize checksum
var validValuesArray; //array of valid values for COGO combinations
var partialValuesArray; //array of partial values for COGO
var directionStr = ""; //direction string using for label
var distanceStr = "";  //distance string using for label
var radiusStr = "";    //radius string using for label
var radius2Str = "";    //radius2 string using for labeling spiral curves
var curveStr = "";     //curve parameter string using for label
var prefixPostfix = ['', '']  //Used for prefix and postfix of COGO Type
var angleRad; //curve angle in radians
var COGOValidity; //COGO combinations validity. can be valid, partial or invalid.

if (IsEmpty(cogo_direction) &amp;amp;&amp;amp; IsEmpty(cogo_distance) &amp;amp;&amp;amp; IsEmpty(cogo_radius) &amp;amp;&amp;amp; IsEmpty(cogo_radius2) &amp;amp;&amp;amp; IsEmpty(cogo_arclength)){
    return ""
}

function NorthAzimuth2Quadbearing(azimuth){
    return ConvertDirection(azimuth, {directionType:'North', angleType: 'Degrees'}, {directionType:'Quadrant', angleType: 'DMS', outputType: 'text', format: 'pd[°]mm[\']ss["]b'})
}

function DMS_North(azimuth){
    return ConvertDirection(azimuth, {directionType:'North', angleType: 'Degrees'}, {directionType:'North', angleType: 'DMS', outputType: 'text', format: 'd[°]mm[\']ss["]'})
}

function DMS_South(azimuth){
    return ConvertDirection(azimuth, {directionType:'North', angleType: 'Degrees'}, {directionType:'South', angleType: 'DMS', outputType: 'text', format: 'd[°]mm[\']ss["]'})
}

function IsValidCOGO(cogo_direction, cogo_distance, cogo_radius, cogo_arclength, cogo_radius2) {
    binaryDictionary= Dictionary('dir', 1, 'dist',2, 'rad',4, 'arc',8, 'rad2',16)
    if (!IsEmpty(cogo_direction)) {checksum+=binaryDictionary.dir}
    if (!IsEmpty(cogo_distance)) {checksum+=binaryDictionary.dist}
    if (!IsEmpty(cogo_radius)) {checksum+=binaryDictionary.rad}
    if (!IsEmpty(cogo_arclength)) {checksum+=binaryDictionary.arc}
    if (!IsEmpty(cogo_radius2)) {checksum+=binaryDictionary.rad2}
    
    validValuesArray=[0,3,13,29]; //array of valid combinations: '0' for nothing, ... '13' for direction &amp;amp; radius &amp;amp; arclength ...
    partialValuesArray=[1,2,4,5,8,9,12,16,17,20,21,24,25,27,28]; //array of partial combinations: '1' for only direction, '2' for only distance, '4' for only radius...
    //Invalid Values = [6,7,10,11,14,15,18,19,22,23,26,30,31]


    if (IndexOf(validValuesArray,checksum)&amp;gt;-1) { // a negative value is returned if checksum value is not in the a valid combination array
        return "valid";
    }
    if (IndexOf(partialValuesArray,checksum)&amp;gt;-1){
        return "partial";        
    }
    return "invalid";
}

function COGOTypePrefixPostfix(cogotypeValue){
    if (ShowCOGOType){
        if (cogotypeValue == 1) { //Entered
           return COGOType_Entered
        }
        else if(cogotypeValue == 2) { //From Geometry
           return COGOType_FromGeom
        }
        else if(cogotypeValue == 3) { //Computed
           return COGOType_Computed
        }
        else { //If not set or invalid value
           return ['', '']
        }
    }
    else{
       return(['', ''])
    }
}

COGOValidity = IsValidCOGO(cogo_direction, cogo_distance, cogo_radius, cogo_arclength, cogo_radius2);
if ( COGOValidity == "invalid") { //if invalid COGO return error string
    return "&amp;lt;BOL&amp;gt;&amp;lt;CLR " + invalidCOGOColor + "&amp;gt;" + fontNameSize + ErrorString + "&amp;lt;/FNT&amp;gt;&amp;lt;/CLR&amp;gt;&amp;lt;/BOL&amp;gt;";    
}

else if (COGOValidity == "partial") { //if a partial COGO change colors
    distanceColor = partialCOGOColor;
    directionColor = partialCOGOColor;
    radiusColor = partialCOGOColor;
    curveParamColor = partialCOGOColor;
}

// Direction string
if (ShowDirection) {
    if (IsEmpty(cogo_direction)==false) {
        if (DirectionType == 1) {  //using quadrant bearing format
            directionStr = NorthAzimuth2Quadbearing(cogo_direction);
        }
        else if (DirectionType == 2) {  //using north azimuth format
            directionStr = DMS_North(cogo_direction);
        }
        else if (DirectionType == 3) { //using south azimuth format
            directionStr = DMS_South(cogo_direction);
        }
    }
}

// Distance string
if (ShowDistance) {
    if (IsEmpty(cogo_distance)==false) {
    distanceStr = text(round(cogo_distance,DistUnitRounding), NumberFormat);
    }
}

//Radius String
if (ShowRadius) {
    if (!IsEmpty(cogo_radius)) { //it can be a curve or a spiral
        if (IsEmpty(cogo_radius2)) { //if radius2 is empty this is a curve
            radiusStr = RadiusAbbr + " " + text(round(cogo_radius, DistUnitRounding), NumberFormat);
        }
        else { // it is a spiral
            radiusStr = RadiusAbbr + " " + text(round(cogo_radius, DistUnitRounding),NumberFormat);
            radius2Str = Radius2Abbr + " " + text(round(cogo_radius2, DistUnitRounding),NumberFormat);
            if (cogo_radius == 0) { //substitute to infinity sign
                radiusStr = RadiusAbbr + " ∞ ";
            }
            if (cogo_radius2 == 0) { //substitute to infinity sign
                radius2Str = Radius2Abbr + " ∞ ";
            }
        }    
        
    }
}

// Curve Parameter
if (ShowCurveParameter) {
        if (!IsEmpty(cogo_arclength)) {
            if (CurveParameter == 'ArcLength') {
                curveStr = text(round(cogo_arclength, DistUnitRounding), NumberFormat); //return Arc length
            }
            angleRad = cogo_arclength/(abs(cogo_radius)) //calculate angle in radians
            if (CurveParameter == 'Angle') {
                curveStr = DMS_North(angleRad * 180 / pi); // convert radian to degrees and show as DMS
            }
            if (CurveParameter == 'Chord') {
                curveStr = text(round((2 * abs(cogo_radius) * Sin(angleRad/2)),DistUnitRounding), NumberFormat); //calculate chord length
            }            
        }
}

//Determine type of curve displayed
var CurveTypePrefix = ""
if (!IsEmpty(curveStr)){
    if (CurveParameter == 'ArcLength'){
        CurveTypePrefix = ArclengthAbrr
    }
    else if (CurveParameter == 'Angle'){
        CurveTypePrefix = AngleAbbr
    }
    else if (CurveParameter == 'Chord'){
        CurveTypePrefix = ChordAbbr
    }
}

var isStraightLine = IsEmpty(radiusStr) &amp;amp;&amp;amp; IsEmpty(radius2Str) &amp;amp;&amp;amp; IsEmpty(curveStr)

// Assemble label string

//Get prefix and postfix if either distance or curve is not empty. NOTE If both aren't empty it's invalid COGO
if (!IsEmpty(distanceStr) || !IsEmpty(curveStr)){
    prefixPostfix = COGOTypePrefixPostfix(cogotype)
}

var sharedLabelBuffer = ""
if (labelPosition == 3) {
    sharedLabelBuffer = " \n"
}

//Straight lines
if (isStraightLine){
    if (!IsEmpty(directionStr) &amp;amp;&amp;amp; !IsEmpty(distanceStr)){ //If Direction and Distance are both NOT Empty
        return fontNameSize + "&amp;lt;CLR " + directionColor + "&amp;gt;" + directionStr  + "&amp;lt;/CLR&amp;gt;" + "\n" +
                              "&amp;lt;CLR " + distanceColor + "&amp;gt;" + prefixPostfix[0] + distanceStr + prefixPostfix[1] + "&amp;lt;/CLR&amp;gt;&amp;lt;/FNT&amp;gt;";
    }
    else if (IsEmpty(directionStr)){  //If Direction is empty
        return fontNameSize + sharedLabelBuffer + "&amp;lt;CLR " + distanceColor + "&amp;gt;" +
                               prefixPostfix[0] + distanceStr + prefixPostfix[1] + "&amp;lt;/CLR&amp;gt;&amp;lt;/FNT&amp;gt;";
    }
    else{  //If Distance is empty
        return fontNameSize + sharedLabelBuffer + "&amp;lt;CLR " + directionColor + "&amp;gt;" + directionStr +  "&amp;lt;/CLR&amp;gt;&amp;lt;/FNT&amp;gt;";
    }
}

//Curves
//If one or both radii and the curve string are NOT empty show the full curve
if ((!IsEmpty(radiusStr) || !IsEmpty(radius2Str)) &amp;amp;&amp;amp; !IsEmpty(curveStr)){
    return fontNameSize + "&amp;lt;CLR " + radiusColor + "&amp;gt;" + radiusStr + "&amp;lt;/CLR&amp;gt;" + " " +
                          "&amp;lt;CLR " + radiusColor + "&amp;gt;" + radius2Str + "&amp;lt;/CLR&amp;gt;" + "\n" +
                          "&amp;lt;CLR " + curveParamColor + "&amp;gt;" + CurveTypePrefix + ' ' +
                          prefixPostfix[0] + curveStr + prefixPostfix[1] + "&amp;lt;/CLR&amp;gt;&amp;lt;/FNT&amp;gt;";
}
//If the curve is empty
else if (IsEmpty(curveStr)){
    return fontNameSize + sharedLabelBuffer + "&amp;lt;CLR " + radiusColor + "&amp;gt;" + radiusStr + "&amp;lt;/CLR&amp;gt;" + "  " +
                          "&amp;lt;CLR " + radiusColor + "&amp;gt;" + radius2Str + "&amp;lt;/CLR&amp;gt;&amp;lt;/FNT&amp;gt;"
}
//If both radius are empty
else{
    return fontNameSize + sharedLabelBuffer + "&amp;lt;CLR " + curveParamColor + "&amp;gt;" + CurveTypePrefix + ' ' +
                          prefixPostfix[0] + curveStr + prefixPostfix[1] + "&amp;lt;/CLR&amp;gt;&amp;lt;/FNT&amp;gt;";
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Feb 2025 21:56:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583341#M1891</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2025-02-07T21:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Default COGO labeling expressions - getting COGO ERROR label</title>
      <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583528#M1892</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/103122"&gt;@RobertChaney&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A "COGO Error" is returned when there are too many parameters. For example, if Direction, Distance, and Radius are all populated.&lt;BR /&gt;It looks like the conversion is placing a zero ('0') if the original value is NULL, instead of keeping it empty.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This can be solved by checking and only converting the units if the attribute is not empty:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AmirBarMaor_0-1739178740962.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124986iAAA64C7FBF8A162E/image-size/large?v=v2&amp;amp;px=999" role="button" title="AmirBarMaor_0-1739178740962.png" alt="AmirBarMaor_0-1739178740962.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (!IsEmpty($feature.Distance)) cogo_distance = cogo_distance*3.28084;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add this check for any value that you convert (distance, radius, arclength, radius2)&lt;/P&gt;&lt;P&gt;Please let us know if this solves the issue&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 09:14:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583528#M1892</guid>
      <dc:creator>AmirBar-Maor</dc:creator>
      <dc:date>2025-02-10T09:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Default COGO labeling expressions - getting COGO ERROR label</title>
      <link>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583845#M1893</link>
      <description>&lt;P&gt;Your expression solved the issue, thanks Amir.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 23:16:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-parcel-fabric-questions/default-cogo-labeling-expressions-getting-cogo/m-p/1583845#M1893</guid>
      <dc:creator>RobertChaney</dc:creator>
      <dc:date>2025-02-10T23:16:52Z</dc:date>
    </item>
  </channel>
</rss>

