2

I am building a cadastral fabric and it's really nice to have the bearing and distance come up on the lines as I traverse around. I just found a great way to do this with the Add Geometry ArcGIS tool. It works most excellent:

Cadastral Traverse

But the issue I am having here is that the field does not auto-populate. I have rerun the Add Geometry tool everytime. Is there anyway to automate calculation? Its a pain to have to traverse a line and then run the tool.

Using the answer of @FelixIP, I was able to get it going, just add this into the label expression, set the parser to python and customise your attributes:

arcpy.AddGeometryAttributes_management(Input_Features="Cadastral Reference Lines", Geometry_Properties="LENGTH;LINE_BEARING", Length_Unit="FEET_US", Area_Unit="SQUARE_METERS", Coordinate_System="PROJCS['NAD_1983_UTM_Zone_17N',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-81.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
def FindLabel ([BEARING], [LENGTH]):
  return [BEARING] + " - " + [LENGTH] + "ft"
3

As mentioned in comments you can access most of the tools and Shape field from label expression:

lr="segments"
arcpy.AddGeometryAttributes_management(lr, "LINE_BEARING",  Coordinate_System="GEOGCS['GCS_NZGD_2000',DATUM['D_NZGD_2000',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")
def FindLabel ( [FID] ):
  with arcpy.da.SearchCursor(lr,('Shape@',"Bearing"),r'"FID"='+str( [FID] )) as cursor:
      for shp, b in cursor:break
  L=shp.length;B=float(b)
  deg=int(B);mins=int((B-deg)*60)
  sec=int((((B-deg)*60)-mins)*60)
  return "{}<SUP>O</SUP>{}'{}'' - {:.2f} m".format(deg,mins,sec,L)

enter image description here

  • I ended up using a bit of yours (THANKS FOR THE HELP!!) – Cody Brown Feb 15 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.