0% found this document useful (0 votes)
52 views

Python Script

This document contains code for performing geospatial analysis in Python using the ArcPy module. It selects school features from a buildings dataset, buffers schools, clips forest data to the school buffers, creates a multi-ring buffer around roads to erase from forests, aggregates population data by district, and performs other geospatial operations to analyze suitable land for schools.

Uploaded by

Clement Kipyegon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Python Script

This document contains code for performing geospatial analysis in Python using the ArcPy module. It selects school features from a buildings dataset, buffers schools, clips forest data to the school buffers, creates a multi-ring buffer around roads to erase from forests, aggregates population data by district, and performs other geospatial operations to analyze suitable land for schools.

Uploaded by

Clement Kipyegon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

# -*- coding: utf-8 -*-

# ---------------------------------------------------------------------------
# nnn.py
# Created on: 2021-06-15 22:13:05.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Set the necessary product code


# import arcinfo

# Import arcpy module


import arcpy

# Local variables:
forests__2_ = "forests"
Special_buildings = "Special_buildings"
school_shp = "C:\\GIS DATA\\New folder\\school.shp"
school_bu_shp = "C:\\GIS DATA\\New folder\\school_bu.shp"
clipped_fo_shp = "C:\\GIS DATA\\New folder\\clipped_fo.shp"
Roads = "Roads"
multibufer_shp = "C:\\GIS DATA\\New folder\\multibufer.shp"
erased_shp = "C:\\GIS DATA\\New folder\\erased.shp"
Quarter = "Quarter"
Quarter_Dissolve =
"C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\Quarter_Dissolve"
population = "C:\\GIS DATA\\gis programming\\Lab_data.mdb\\population"
Business_areas = "Business_areas"
school_bu_Union =
"C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\school_bu_Union"
forests = "forests"
clipped_forest_shp = "C:\\GIS DATA\\New folder\\clipped forest.shp"
unwanted_shp = "C:\\GIS DATA\\New folder\\unwanted.shp"
useful = "C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\useful"
suitable = "C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\suitable"
Aggrega_popu1 = "C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\Aggrega_popu1"
school_bu_Intersect =
"C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\school_bu_Intersect"

# Process: Select
arcpy.Select_analysis(Special_buildings, school_shp, "[type] = 'school'")

# Process: Buffer
arcpy.Buffer_analysis(school_shp, school_bu_shp, "1500 Meters", "FULL", "ROUND",
"ALL", "", "PLANAR")

# Process: Clip (2)


arcpy.Clip_analysis(forests__2_, school_bu_shp, clipped_fo_shp, "")

# Process: Multiple Ring Buffer


arcpy.MultipleRingBuffer_analysis(Roads, multibufer_shp, "500;1000", "Default",
"distance", "ALL", "FULL")

# Process: Erase
arcpy.Erase_analysis(clipped_fo_shp, multibufer_shp, erased_shp, "")

# Process: Dissolve
arcpy.Dissolve_management(Quarter, Quarter_Dissolve, "Shape_Area", "",
"MULTI_PART", "DISSOLVE_LINES")

# Process: Union
arcpy.Union_analysis("'C:\\GIS DATA\\New folder\\school_bu.shp' #;Business_areas
#", school_bu_Union, "ALL", "", "GAPS")

# Process: Clip
arcpy.Clip_analysis(forests, school_bu_shp, clipped_forest_shp, "")

# Process: Union (2)


arcpy.Union_analysis("C:\\Users\\user\\Documents\\ArcGIS\\Default.gdb\\school_bu_Un
ion #;'C:\\GIS DATA\\New folder\\clipped forest.shp' #", unwanted_shp, "ALL", "",
"GAPS")

# Process: Union (3)


arcpy.Union_analysis("'C:\\GIS DATA\\New folder\\unwanted.shp' #;Quarter #",
useful, "ALL", "", "GAPS")

# Process: Aggregate
arcpy.gp.Aggregate_sa(population, Aggrega_popu1, "15", "SUM", "EXPAND", "DATA")

# Process: Intersect
arcpy.Intersect_analysis("'C:\\GIS DATA\\New folder\\school_bu.shp' #;'C:\\GIS
DATA\\New folder\\multibufer.shp' #", school_bu_Intersect, "ALL", "", "INPUT")

# Process: Reclassify
arcpy.gp.Reclassify_sa(population, "VALUE", "", suitable, "DATA")

You might also like