# Name: Flight_Line_Buffer.py # Description: Creates area of Aerial Photography coverage based on digitized flight lines, and associated flight height field in flight line table. #Import system modules import arcpy from arcpy import env # Set environment settings env.workspace = "J:\Flight_Lines_GDB\Flight_Lines_Coverage.gdb" env.Outworkspace = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" # Create buffer distance output from Flight Height field, and buffer flight lines Flightlines = "J:\Flight_Lines_GDB\Flight_Lines_Coverages.gdb" PhotoCoverages = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" distanceField = "Flight_Height" sideType = "FULL" endType = "FLAT" dissolveType = "NONE" arcpy.Buffer_analysis(Flightlines, PhotoCoverages, distanceField, sideType, endType, dissolveType)
Solved! Go to Solution.
# Name: Flight_Line_Buffer.py # Description: Creates area of Aerial Photography coverage based on digitized flight lines, and associated flight height field in flight line table. #Import system modules import arcpy from arcpy import env # Set environment settings env.workspace = "J:\Flight_Lines_GDB\Flight_Lines_Coverage.gdb" env.Outworkspace = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" # Create buffer distance output from Flight Height field, and buffer flight lines PhotoCoverages = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" fdOutput = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" #fetches all feaure datasets in workspace into a list fdlist = arcpy.ListDatasets() # loop through feature datasets in the list for fd in fdlist: print fd #setting new workspace to the feature dataset we are using arcpy.CopyManagement(fd , fdOutput + "/" + fd) env.workspace = fd # fetches all feature classes in workspace into a list fclist = arcpy.ListFeatureClasses() #loop through feature classes in our list for fc in fclist: FCOutput = fdOutput + "/" + fd distanceField = "Flight_Height" sideType = "FULL" endType = "FLAT" dissolveType = "NONE" multiplier = 1.502167099846 cursor = arcpy.SearchCursor(fc, ["distanceField"]) count = 1 for row in cursor: distance = float(row[0])*(multiplier)) arcpy.Buffer_analysis(fc, FCOutput + "/" + fc + "_Buffer" + str(count) , distance, sideType, endType, dissolveType) count += 1 del row del cursor
# Name: Flight_Line_Buffer.py # Description: Creates area of Aerial Photography coverage based on digitized flight lines, and associated flight height field in flight line table. #Import system modules import arcpy from arcpy import env # Set environment settings env.workspace = "J:\Flight_Lines_GDB\Flight_Lines_Coverage.gdb" env.Outworkspace = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" # Create buffer distance output from Flight Height field, and buffer flight lines PhotoCoverages = "J:\Aerial_Photo_GDB\Aerial_Photography_Coverage.gdb" #fetches all feaure datasets in workspace into a list fdlist = arcpy.ListDatasets() # loop through feature datasets in the list for fd in fdlist: #setting new workspace to the feature dataset we are using env.workspace = fd # fetches all feature classes in workspace into a list fclist = arcpy.ListFeatureClasses() #loop through feature classes in our list for fc in fclist: distanceField = "Flight_Height" sideType = "FULL" endType = "FLAT" dissolveType = "NONE" multiplier = 1.502167099846 cursor = arcpy.SearchCursor(fc) for row in cursor: distance = ((row.getValue(distanceField))*(multiplier)) arcpy.Buffer_analysis(fc, PhotoCoverages, distance, sideType, endType, dissolveType) del row del cursor
Alternatively to using the cursor, you could just make a field in each feature classes that was the flight height multiplied by the float value you are using, then just use that field value as the value for the buffer, so you are using the field name as input instead of a number.
Ian,
WOW. Thanks for the help, I do have feature classes with multiple records. Is it possible to work with that same code and modify it to work? The reason I have multiple datasets and feature classes is I am working with statewide data, and needed to be able to apply the state plane coordinates to each different area based on county, and then have feature classes based on towns. However, some towns have multiple flight lines so they required multiple records in the feature class.
Currently I am working mostly with the ESRI Press Python Scripting for ArcGIS book. Are there any other resources you could recommend for a person new to programming to get a good start with. I need to preserve the feature datasets into the new geodatabase as well. How would that best fit into the script example you have given?
Thanks again for your help, I'm really taken aback at how helpful the Python community as a whole is.
Todd Howell