output_value = "building_address_w_single_ED_9.shp" building_w_multiple_Simplify1 = "C:\\Users\\eplack\\Documents\\ArcGIS\\Default.gdb\\building_w_multiple_Simplify1" output_value__3_ = "building_w_multiple_ED_9.shp" building_w_multiple_Simplify2 = "C:\\Users\\eplack\\Documents\\ArcGIS\\Default.gdb\\building_w_multiple_Simplify2" output_value__2_ = "address_unmatched_ED_9.shp" building_address_w_single_ED_10_shp = "C:\\LocalGIS\\OSM\\model\\split\\building_address_w_single_ED_9.shp" building_address_w_single_ED1 = "C:\\Users\\eplack\\Documents\\ArcGIS\\Default.gdb\\building_address_w_single_ED1" building_w_multiple_ED_1_shp__2_ = "C:\\LocalGIS\\OSM\\model\\split\\building_w_multiple_ED_9.shp" building_w_multiple_ED_1_Sim = "C:\\Users\\eplack\\Documents\\ArcGIS\\Default.gdb\\building_w_multiple_ED_1_Sim" address_unmatched_ED_1_shp__2_ = "C:\\LocalGIS\\OSM\\model\\split\\address_unmatched_ED_9.shp" building_address_w_single__3_ = "Import\\building_address_w_single" selected_buildings = "Import\\building_w_multiple" address_not_matched__3_ = "Import\\address_not_matched" # Process: Iterate Feature Selection arcpy.IterateFeatureSelection_mb(ADMIN_ElectionDistricts, "", "false") # Process: Select Layer By Location arcpy.SelectLayerByLocation_management(building_address_w_single, "INTERSECT", districtIterator, "", "NEW_SELECTION") # Process: getDistrictNum arcpy.GetFieldValue_mb(districtIterator, "ELECTION_DISTRICTS", "String", "water") # Process: rename building_w_single arcpy.CalculateValue_management( "ElectionDistrict (\"%ElectionDistrict%\")", "def ElectionDistrict (ElectionDistrict):\\n outputName=\"\"\"building_address_w_single_ED_%ElectionDistrict%\"\"\"\\n return outputName", "String")
# Import arcpy import arcpy # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # Load required toolboxes arcpy.ImportToolbox("Model Functions") # Local variables: WDPA = "WDPA" Agri_raster = "E:\\xxx\\CROPLAND2005.tif" agri_wdpa_all = "E:\\xxx\\precipitation.gdb\\agri_wdpa_all" WDPA_wdpa_id_text = "WDPA_wdpa_id_text" agri__Value_ = "E:\\xxx\\AGRI_OUTPUT.gdb\\ele_%Value%" # Process: Loop through the features arcpy.IterateFeatureSelection_mb(WDPA, "wdpa_id_text #", "false") # Process: Zonal Statistics arcpy.gp.ZonalStatisticsAsTable_sa(WDPA_wdpa_id_text, "wdpa_id_text", Agri_raster, agri__Value_, "DATA", "ALL") # Process: Append arcpy.Append_management( "E:\\xxx\\AGRI_OUTPUT.gdb\\ele_%Value%", agri_wdpa_all, "NO_TEST", "COUNT \"COUNT\" true true false 4 Long 0 0 ,First,#,\ E:\\xxx\\AGRI_OUTPUT.gdb\\ele_%Value%,Range,-1,-1;MEAN \"MEAN\" true true false 8 Double 0 0 ,First,#, wdpa_id_text \"wdpa_id_text\" true true false 50 Text 0 0 ,First,#, \ E:\\xxx\\AGRI_OUTPUT.gdb\\ele_%Value%,wdpa_id_text,-1,-1", "")
# Script arguments gdbtemp = arcpy.GetParameterAsText(0) if gdbtemp == '#' or not gdbtemp: gdbtemp = "C:\\datatemp\\cum_viewshed.gdb" # provide a default value if unspecified # Local variables: avkat_dem = "C:\\datatemp\\datatemp.gdb\\avkat_dem" viewshed_sample_points = "C:\\datatemp\\datatemp.gdb\\viewshed_sample_points" I_sample_points = viewshed_sample_points viewshed_value_ = "C:\\datatemp\\cum_viewshed.gdb\\viewshed%value%" Value = "1330" Output_above_ground_level_raster = "" # Process: Iterate Feature Selection arcpy.IterateFeatureSelection_mb(viewshed_sample_points, "", "false") # Process: Viewshed arcpy.gp.Viewshed_sa(avkat_dem, I_sample_points, viewshed_value_, "1", "CURVED_EARTH", "0.13", Output_above_ground_level_raster) #Step 3: viewshedadder Iterative function where we take all the view sheds and add them together. All feature viewsheds are being added into one cumulative viewshed file. # Load required toolboxes arcpy.ImportToolbox("Model Functions") # Script arguments cum_viewshed_gdb = arcpy.GetParameterAsText(0) if cum_viewshed_gdb == '#' or not cum_viewshed_gdb: cum_viewshed_gdb = "C:\\datatemp\\cum_viewshed.gdb" # provide a default value if unspecified
Clipped_Rural_Population_Count = "D:\\SDG_911\\SDG_911.gdb\\Clipped_Rural_Population_Count" rural_pop = "D:\\SDG_911\\SDG_911.gdb\\rural_pop" Joined_table = rural_pop Roads_Clip = "D:\\SDG_911\\SDG_911.gdb\\Intermediate_data\\Road_CLIP" Road_Buffer_1 = "D:\\SDG_911\\SDG_911.gdb\\Intermediate_data\\Road_CLIP_buffer1" Road_Buffer_2 = "D:\\SDG_911\\SDG_911.gdb\\Intermediate_data\\Road_CLIP_buffer2" Road_Buffer_3 = "D:\\SDG_911\\SDG_911.gdb\\Intermediate_data\\Road_CLIP_buffer3" Road_Buffer_4 = "D:\\SDG_911\\SDG_911.gdb\\Intermediate_data\\Road_CLIP_buffer4" Road_Buffer_Reprojected = "D:\\SDG_911\\SDG_911.gdb\\Road_CLIP_buffer_Mollweide" ruralpop_in_2km = "D:\\SDG_911\\SDG_911.gdb\\ruralpop_in_2km" Result_Table = Joined_table Result_Table__2_ = Result_Table Output_Table_Output = Result_Table__2_ # Process: Iterate through country codes arcpy.IterateFeatureSelection_mb(Input_Country_Boundaries, "ISO #", "false") # Process: Clip (2) arcpy.Clip_management( Input_Global_Rural_Population_Raster, "-15641162.1443 2321790.7856 13401188.7741 8720711.1295", Clipped_Rural_Population_Count, Iterator_Country_Output, "-3.400000e+38", "NONE", "NO_MAINTAIN_EXTENT") # Process: Zonal Statistics as Table arcpy.gp.ZonalStatisticsAsTable_sa(Iterator_Country_Output, "ISO", Clipped_Rural_Population_Count, rural_pop, "DATA", "SUM") # Process: Clip arcpy.Clip_analysis(Input_Roads, Iterator_Country_Output, Roads_Clip, "")
Input_Contour_lines = arcpy.GetParameterAsText(0) # Local variables: Data = Input_Contour_lines Path = "FILE" Value = "1" output_1 = "%Path%\\%Name%_polygon_temp_%Value%.shp" alter_1 = output_1 alter_2 = alter_1 Name = "FILE" # Process: Parse Path arcpy.ParsePath_mb(Input_Contour_lines, "PATH") # Process: Iterate Feature Selection arcpy.IterateFeatureSelection_mb(Input_Contour_lines, "CONTOUR #", "false") # Process: Feature To Polygon tempEnvironment0 = arcpy.env.outputMFlag arcpy.env.outputMFlag = "Same As Input" arcpy.FeatureToPolygon_management("''", output_1, "", "NO_ATTRIBUTES", "") arcpy.env.outputMFlag = tempEnvironment0 # Process: Add Field arcpy.AddField_management(output_1, "Contour", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "") # Process: Calculate Field arcpy.CalculateField_management(alter_1, "Contour", "%Value%", "VB", "") # Process: Parse Name arcpy.ParsePath_mb(Input_Contour_lines, "NAME")
arcpy.ImportToolbox("模型函数") # Script arguments 输入要素 = arcpy.GetParameterAsText(0) 按字段分组 = arcpy.GetParameterAsText(1) 工作空间 = arcpy.GetParameterAsText(2) 跳过空值 = arcpy.GetParameterAsText(3) if 跳过空值 == '#' or not 跳过空值: 跳过空值 = "false" # provide a default value if unspecified 输出要素类 = arcpy.GetParameterAsText(4) prefix = arcpy.GetParameterAsText(5) # Local variables: 所选要素 = 输入要素 value = 输入要素 suffix = "" # Process: 迭代要素选择 # 此工具专用于模型构建器,而并不在编写 Python 脚本时使用。 # XXX_mb工具专用于模型构建器 arcpy.IterateFeatureSelection_mb(输入要素, 按字段分组, 跳过空值) # Process: 要素类至要素类 arcpy.FeatureClassToFeatureClass_conversion(所选要素, 工作空间, "%prefix%%value%", "", "", "")