import arcpy, os # featureclasses polylineFC = r'C:\Path\To\Your\filegeodatabase.gdb\Pipelines' # edit this! fldID = "NameOfYourUniqueIDfield" # outputs outWS = r'C:\Path\To\Your\filegeodatabase.gdb' # output workspace outFromNodes = 'FromNodes' # output names outToNodes = 'ToNodes' # output names # Set local variables geometry_type = "POINT" has_m = "ENABLED" has_z = "ENABLED" # Use Describe to get a SpatialReference object spatial_reference = arcpy.Describe(polylineFC).spatialReference # Execute CreateFeatureclass arcpy.CreateFeatureclass_management(outWS, outFromNodes, geometry_type, polylineFC, has_m, has_z, spatial_reference) arcpy.CreateFeatureclass_management(outWS, outToNodes, geometry_type, polylineFC, has_m, has_z, spatial_reference) # make nodeDict polylines featuresFrom = [] featuresTo = [] lstIDs = [] curF = arcpy.da.InsertCursor(outWS + os.sep + outFromNodes,("SHAPE@", fldID)) curT = arcpy.da.InsertCursor(outWS + os.sep + outToNodes,("SHAPE@", fldID)) with arcpy.da.SearchCursor(polylineFC, ("SHAPE@", fldID)) as cursor: for row in cursor: polyline = row[0] uniqueID = row[1] pntF = polyline.firstPoint pntT = polyline.lastPoint curF.insertRow((pntF,uniqueID)) curT.insertRow((pntT,uniqueID)) del row del curT del curF
Now I have a point file with the absolute depths of the end points of the pipes in one field of the attribute table and a seperate line file of the pipes. Feature to 3d by attribute has a "to" and "from" option, but I would need to use the lines as input features and add the to and from values from the points to the attribute table of the lines (and I'm not sure how to approach that problem). However, it seems like there *should* be a tool to create a 3D layer from the lines using the depths at the locations of the points (kind of like how you would derive the z values for surface features from a DEM). Any ideas?
So, now I have a different problem. I am trying to use 'feature vertices to points' for another feature and I have 24,755 lines, but it gives me both 93,540 begin and end points. I took a look at the situation by selecting generated startpoints with the same objected and the related line, so I can see what the situation is (see attached screenshot), but I don't know how to deal with this. If I determine the DEM at these points, how would I again couple it to a line to create a 3D model by attributes?Ideas?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.