1

I am asking for help with generating an automated process to do what I am tediously doing manually at the moment. I want to know the 3D distance between buildings and a tunnel. I have several building points and a set of tunnel points (one point per meter inside the tunnel).

This is how I have been doing it so far: I am running Near 3D tool to find distances between each building point and each tunnel point (I only have the basic license so I cannot use Generate Near Table tool). In Near 3D the tunnel point set is the input feature and one building point is the near feature. Afterwards I run Alter Field tool to change the name of the 3D distance field in the attribute table (NEAR_DIST3) to the address (and filename) of the building point:

modelbuilder

I then do this with every single building point, in model builder, so the attribute table of the tunnel points gets several fields named after the given building point.

I have attempted writing a script to solve this myself, but I am not very experienced with python so it is just from the model builder:

# Near 3D
arcpy.Near3D_3d(inpoints_N2, "'C:\\GIS\\distance.gdb\\Streetname123Apt456'", "2000 Meters", "NO_LOCATION", "NO_ANGLE", "NO_DELTA")
# Alter Field
arcpy.AlterField_management(inpoints_N2__9_, "NEAR_DIST3", "Streetname123Apt456", "", "DOUBLE", "8", "NULLABLE", "false")
# Near 3D (2)
arcpy.Near3D_3d(inpoints_N2__2_, "'C:\\GIS\\distance.gdb\\Streetname123Apt457'", "2000 Meters", "NO_LOCATION", "NO_ANGLE", "NO_DELTA")
# Alter Field (2)
arcpy.AlterField_management(inpoints_N2__6_, "NEAR_DIST3", "Streetname123Apt457", "", "DOUBLE", "8", "NULLABLE", "false")

Writing this manually also seems unnecessarily time consuming. Does anyone have a suggestion how I can setup a model in model builder or rewrite the script to avoid doing this point by point?

I am using ArcGIS 10.3 with basic license and 3D Analyst and Spatial Analyst extensions.

2
  • 1
    Sounds like are looping over a set of tunnel points per building point? To loop in model builder you need to use an iterator, so read the help file on iterators. If you want to loop within a loop then you need to create sub-models and embed those into a master model, again read the help file.
    – Hornbydd
    Aug 23, 2017 at 22:37
  • Thanks @Hornbydd, using the iterator and sub-models is working very well!
    – Sil
    Sep 12, 2017 at 13:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.