Select to view content in your preferred language

Change the Pro COGO 'Direction' number format into a text string?

3267
11
Jump to solution
10-11-2021 05:36 AM
mcguerd
Occasional Contributor

Does anyone know how to change the formatting of the COGO 'Direction' number format into a text string to import into ArcMap COGO?

I can copy paste from the direction field to a text field and it keeps the formatting but if I try and do a calculate field it just turns into a number...N14°27'50.00"E calculates to 14.4638888893333 but if I copy/paste it returns N14°27'50.00"E.

I want to use Pro but the SDE was set up using ArcMap and the 'direction' format is different.

Any suggestions?

Thanks

0 Kudos
2 Solutions

Accepted Solutions
AmirBar-Maor
Esri Regular Contributor

You can use both ArcMap and ArcGIS Pro clients against the same feature class.

To use Pro as your primary client you can:

1. Run geoprocessing Enable COGO from ArcGIS Pro against the feature class in your SDE.

2. Download this geoprocessing script tool

3. Run the tool from ArcGIS Pro against the feature class in your SDE

4. Add the feature class to a map in ArcGIS Pro - it will be added with COGO symbology, labeling, display expression etc.

If you really need to have the fields update as strings in the old ArcMap fields, you can use the logic in the label expression to do it or use the Arcade method 'ConvertDirection' and an Attribute Rule Calculation.

 

 

View solution in original post

TimHodson
Esri Contributor

Hi mcguerd, here's a quick way to calculate a text field and populate it with the quadrant bearing text by converting it from a double that represents north azimuth, decimal degrees:

1. Open the Attribute table of the line layer:

TimHodson_0-1633989248647.png

 

2. Right-click the column header of the Text field you want to calculate, and click "Calculate Field"

TimHodson_1-1633989334344.png

3. Set the Expression type to Arcade:

TimHodson_2-1633989476587.png

 

Copy the following Arcade function and expression into the code block area, and click OK or Apply. Of course, you can adapt the code if you want to change the symbols like the "°" into a "-" etcetera. This expression also assumes your source field name is called "Direction" .

 

 

 

function NorthAzimuth2Quadbearing(azimuth){
  return ConvertDirection( azimuth, {directionType:'North', angleType: 'Degrees'}, {directionType:'Quadrant', angleType: 'DMS', outputType: 'text', format: 'pd[°]mm[\']ss["]b'})
  }
NorthAzimuth2Quadbearing($feature.Direction)

 

 

 

View solution in original post

11 Replies
AmirBar-Maor
Esri Regular Contributor

You can use both ArcMap and ArcGIS Pro clients against the same feature class.

To use Pro as your primary client you can:

1. Run geoprocessing Enable COGO from ArcGIS Pro against the feature class in your SDE.

2. Download this geoprocessing script tool

3. Run the tool from ArcGIS Pro against the feature class in your SDE

4. Add the feature class to a map in ArcGIS Pro - it will be added with COGO symbology, labeling, display expression etc.

If you really need to have the fields update as strings in the old ArcMap fields, you can use the logic in the label expression to do it or use the Arcade method 'ConvertDirection' and an Attribute Rule Calculation.

 

 

mcguerd
Occasional Contributor
Thanks. I am not the only editor and most are still using ArcMap. I will try to figure out the ‘ConvertDirection’
0 Kudos
mcguerd
Occasional Contributor

Thanks - I will have to check out the tool and test it against the sde. I really appreciate your help!!

0 Kudos
mcguerd
Occasional Contributor

Actually now I have another question on this for you...since the sde 'COGO' line used in ArcMap is a text, I get an error trying to run the 'Enable Cogo' tool. It just says that the line direction format is incorrect. Do I need to run it in ArcMap instead of Pro?

0 Kudos
AmirBar-Maor
Esri Regular Contributor

@mcguerd 

Because both COGO schemas use the same field name ('Direction')  but one is a String and one is a Double, it will not be possible to use both ArcMap and ArcGIS Pro against the same feature class as I have wrongly suggested.

I would recommend moving to Pro following the steps above. It is still a simple feature class that can be viewed in ArcMap.

0 Kudos
TimHodson
Esri Contributor

Hi mcguerd, here's a quick way to calculate a text field and populate it with the quadrant bearing text by converting it from a double that represents north azimuth, decimal degrees:

1. Open the Attribute table of the line layer:

TimHodson_0-1633989248647.png

 

2. Right-click the column header of the Text field you want to calculate, and click "Calculate Field"

TimHodson_1-1633989334344.png

3. Set the Expression type to Arcade:

TimHodson_2-1633989476587.png

 

Copy the following Arcade function and expression into the code block area, and click OK or Apply. Of course, you can adapt the code if you want to change the symbols like the "°" into a "-" etcetera. This expression also assumes your source field name is called "Direction" .

 

 

 

function NorthAzimuth2Quadbearing(azimuth){
  return ConvertDirection( azimuth, {directionType:'North', angleType: 'Degrees'}, {directionType:'Quadrant', angleType: 'DMS', outputType: 'text', format: 'pd[°]mm[\']ss["]b'})
  }
NorthAzimuth2Quadbearing($feature.Direction)

 

 

 

mcguerd
Occasional Contributor

Perfect!!! This is exactly what I was looking for but could not figure out for myself...Thank you sooooo much!!

0 Kudos
LadyFranciscarKassama
Emerging Contributor

Hi Tim. Thanks for your response to the question. I found your response to this issue heading to my goal. How can the text be converted so that it uses space and dashes to show the values so instead of  N90°00'00"E, I need to read as N 90-00-00 E?

Thanks. 

0 Kudos
TimHodson
Esri Contributor

Hi @LadyFranciscarKassama 

Here is how to do that:

function NorthAzimuth2Quadbearing(azimuth){
  return ConvertDirection( azimuth, {directionType:'North', angleType: 'Degrees'}, {directionType:'Quadrant', angleType: 'DMS', outputType: 'text', format: 'p d[-]mm[-]ss b'})
  }
NorthAzimuth2Quadbearing($feature.Direction)

 

Note, I have also made an update to the original answer. The updated code is reduced to a single line within the function, and shows how to use the text output type, and the use of formatting capabilities available on the ConvertDirection function. This approach is also included in the snippet above on this post for your request.

To learn more about this function see: convertdirection

-Tim