I am trying to create a separate skyline
shapefile for every feature ID
I have in my point file by splitting them into multiple files. The code works fine, except splitting them into multiple shapefiles takes extremely long time. I have 65000 points in the shapefile. I have attached a photo of how I split my files. Once I split them, I point to each shapefile using the below code.
Splitting so many points currently takes about 25-30 hours on my computer. I use QGIS
for this because I do not have advanced license for arcpy.Split_analysis
tool to work with ArcMap
.
Is there a better way than splitting the point file every time?
import arcpy, glob
# reading all the shapefiles
arcpy.env.workspace = "C:\\centrelinepoints"
files = glob.glob("C:\\centrelinepoints\*.shp")
#running the skyline function on each point file separately.
for file in files:
## creating a unique name extension for each skyline shape output file based on its feature ID.
name = file
parts = name.split('_')
newname = parts[5]
final = newname.split('.')
FID = final[0]
## definiing the output layer location and name based on their feature ID.
output_layer = "H:\\skylineshapes\Skyline_" + FID + ".shp"
output_angle = "H:\\skylineangles\Skyline_" + FID + ".dbf"
arcpy.Skyline_3d(file, output_layer, inSurface)
arcpy.SkylineGraph_3d(file, output_layer, "0", "ADDITIONAL_FIELDS", output_angle)