1, Background
A reasonable school space layout is conducive to students' class and life. The location of the school needs to consider the geographical location, the supporting facilities of students' entertainment places, the distance from the existing school and other factors. Grasping these factors on the whole can determine the school location area with better suitability.
2, Purpose
Through practice, be familiar with ArcGIS grid data distance mapping, cost distance weighting, data reclassification, multi-level merging and other spatial analysis functions; be proficient in using ArcGIS spatial analysis functions to analyze and result practical application problems similar to school site selection.
3, Data
(1) landuse (land use map);
(2) DEM (ground elevation map);
(3) rec _ Sites (distribution map of entertainment places);
(4) School (distribution map of existing schools).
(\Chp8 \ Ex1 \)
4, Request
(1) The following points should be paid attention to in the site selection of the new school: ① the new school should be located at a relatively flat place; ② the establishment of the new school should be comprehensively considered in combination with the existing land use type and select the area with low cost; ③ the new school should be matched with the existing entertainment facilities, and the closer the school is to these facilities, the better; ④ the new school should avoid the existing schools and be reasonably distributed.
(2) The weight ratio of each data layer is: distance from entertainment facilities accounts for 0.5, distance from schools accounts for 0.25, and land use type and terrain location factors account for 0.125 respectively.
(3) The implementation process is completed by using some functions of spatial analysis in ArcGIS extension module, including slope calculation, straight-line distance mapping, reclassification and grid calculator.
(4) The suitable area map for new schools is given and briefly analyzed.
5, Implementation flow chart
To realize the analysis of school site selection in ArcGIS, firstly, the slope data and the distance data set to the existing school and entertainment place are derived from the existing school data set, the existing entertainment place data set and the elevation data. Then, the data set is reclassified to the same level range, and then the weight value is assigned according to the influence rate of the above data set in school site selection. Finally, these data can be created by merging these data A map showing the distribution of suitable locations for new schools. The logical process of school site selection mainly includes four parts (as shown in the figure below, the dark part of the result is the school candidate area).
(1) Data preparation: determine which data is required as input, including elevation data (dem), land use data (landuse), existing school data (school) and entertainment site data (rec_; sites);
(2) Derived data set, which derives the original cost data that can provide school location from the existing data, including slope data, distance to the existing school data set and entertainment place data set;
(3) Reclassify various data sets, eliminate the dimensional impact of each cost data set, and make each cost data have roughly the same comparable classification system. Each cost data is divided into 1 ~ 10 levels according to the principle of equally spaced classification, and the higher the level, the better the suitability
(4) Give weight to each data set. If necessary, give higher weight to the data set with greater influence in the suitability model, and then combine each data set to find the appropriate location.
6, Model builder
7, ArcPy implementation
# -*- coding: utf-8 -*- # --------------------------------------------------------------------------- # 8-1 school site selection.py # Created on: 2021-10-12 13:19:17.00000 # (generated by ArcGIS/ModelBuilder) # Description: # --------------------------------------------------------------------------- # Import arcpy module import arcpy from arcpy import Raster import os import shutil import time print time.asctime() path = raw_input("Please enter the absolute path of the folder where the data is located(If it is a database, bring the database name): ").decode("utf-8") if "db" in path: paths = os.path.split(path)[0] + '\\result' else: paths = path + "\\result" # Start timing time_start = time.time() if not os.path.exists(paths): os.mkdir(paths) else: shutil.rmtree(paths) os.mkdir(paths) # Local variables: rec_sites = path + "\\rec_sites" dem = path + "\\dem" landuse = path + "\\landuse" school = path + "\\school" # Warm suggestion: the name of the output file cannot exceed 13 characters Direct_grid1 = "Direct_grid1" Reverse_grid1 = "Reverse_grid1" Direct_grid2 = "Direct_grid2" Reverse_grid2 = "Reverse_grid2" Dist_recsites = "Dist_recsites" Re_recsite = "Re_recsite" Dist_schools = "Dist_schools" Re_schools = "Re_schools" Slope_dem = "Slope_dem" Re_slope = "Re_slope" land_use = "land_use" Re_landuse = "Re_landuse" site_result = "School site selection results" # Set Geoprocessing environments print "Set Geoprocessing environments" arcpy.env.scratchWorkspace = paths arcpy.env.workspace = paths arcpy.env.extent = landuse arcpy.env.cellSize = dem arcpy.env.mask = landuse # Process: feature to grid print "Process: Feature to grid" arcpy.FeatureToRaster_conversion(landuse, "Land_use", land_use, "5") # Process: reclassification print "Process: Reclassification" arcpy.gp.Reclassify_sa(land_use, "Land_use", "'city center' 3;transnational 7;public 10;vegetable 4;agriculture 5;forest 2;'barren land' 1", Re_landuse, "DATA") # Process: slope print "Process: slope" arcpy.gp.Slope_sa(dem, Slope_dem, "DEGREE", "1", "PLANAR", "METER") # Process: reclassification (2) print "Process: Reclassification (2)" arcpy.gp.Reclassify_sa(Slope_dem, "Value", "0.108518 6.291646 10;6.291646 10.751648 9;10.751648 15.131917 8;15.131917 19.819941 7;19.819941 24.931349 6;24.931349 30.529348 5;30.529348 36.494091 4;36.494091 42.837433 3;42.837433 50.637821 2;50.637821 71.992943 1", Re_slope, "DATA") # Process: Euclidean distance print "Process: Euclidean distance " arcpy.gp.EucDistance_sa(rec_sites, Dist_recsites, "", dem, Direct_grid1, "PLANAR", "", Reverse_grid1) # Process: Euclidean distance (2) print "Process: Euclidean distance (2)" arcpy.gp.EucDistance_sa(school, Dist_schools, "", dem, Direct_grid2, "PLANAR", "", Reverse_grid2) # Process: reclassification (3) print "Process: Reclassification (3)" arcpy.gp.Reclassify_sa(Dist_recsites, "Value", "0 61.846584 10;61.846584 111.018013 9;111.018013 158.113876 8;158.113876 206.155289 7;206.155289 256.320099 6;256.320099 309.273346 5;309.273346 366.230804 4;366.230804 427.463440 3;427.463440 492.544403 2;492.544403 614.837402 1", Re_recsite, "DATA") # Process: reclassification (4) print "Process: Reclassification (4)" arcpy.gp.Reclassify_sa(Dist_schools, "Value", "0 93.941475 10;93.941475 155.724121 9;155.724121 212.896683 8;212.896683 269.258240 7;269.258240 326.955658 6;326.955658 388.490662 5;388.490662 454.009918 4;454.009918 521.176575 3;521.176575 598.539917 2;598.539917 738.782776 1", Re_schools, "DATA") # Process: grid calculator # arcpy.gp.RasterCalculator_sa("\"%Re_recsite%\" * 0.5 + \"%Re_schools%\" * 0.25 + \"%Re_slope%\" * 0.125 + \"%Re_landuse%\" * 0.125", site_result) # Process: multiplication and addition print "Process: Multiplication and addition" (Raster('Re_recsite') * 0.5 + Raster('Re_schools') * 0.25 + Raster('Re_slope') * 0.125 + Raster('Re_landuse') * 0.125).save(site_result) save = [u"School site selection results"] rasters = arcpy.ListRasters() for raster in rasters: if raster.lower() not in save: print u"Deleting{}layer ".format(raster) arcpy.Delete_management(raster) # End timing time_end = time.time() # Calculation time time_all = time_end - time_start print time.asctime() print "Execution complete!>>><<< Total time{:.0f}branch{:.2f}second".format(time_all // 60, time_all % 60)
8, Results
End of experiment byebye~