Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. arcpy.CheckOutExtension('Spatial')
  2. #use 'CURRENT' if running from arcmap, when published use MXD on disk
  3. mxd = arcpy.mapping.MapDocument(workspace+"\working_environment.mxd")
  4. df = arcpy.mapping.ListDataFrames(mxd)[0] # address location data frame and turn on select layers
  5. df.zoomToSelectedFeatures()
  6.  
  7.  
  8.  
  9. arcpy.env.extent = df.extent #set extent to current one
  10. arcpy.env.overwriteOutput = True #overwrite existing files
  11.  
  12. my_point_features = autoLayerGDB +"\coded_xy_points_FIPS4203"
  13. scratch_output = workspace+"scratch"
  14.  
  15.  
  16. #Select each district via script
  17.  
  18. for i in range(1, 11):
  19. my_clause = 'COUNCILDISTRICT = %d' % i
  20. my_filename = "kden_d%d" % i
  21. selection_subset = arcpy.MakeFeatureLayer_management(my_point_features, "templayer", where_clause=my_clause)
  22. outKDens = KernelDensity("templayer", "None", cell_size=100)
  23. outKDens.save(autoLayerGDB+"\"+my_filename)
  24. print("tRaster created for District %d" % i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement