-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Generated by ArcGIS ModelBuilder on : 2021-10-01 09:46:07 | ||
""" | ||
import arcpy | ||
from sys import argv | ||
|
||
def HOLC(NHGIS_Census_Boundaries, HOLC_Polygons="holc_ad_data", Output_Location="C:\\Users\\jmadron\\Documents\\ArcGIS\\Projects\\Census_HOLC\\Census_HOLC.gdb\\Intersect_Dissolve", Dissolve_Field_s_=["GISJOIN", "neighborho"], Statistics_Field_s_=[["Perc", "SUM"], ["holc_grade", "FIRST"]]): # Census Data & HOLC Polygons | ||
|
||
# To allow overwriting outputs change overwriteOutput option to True. | ||
arcpy.env.overwriteOutput = False | ||
|
||
arcpy.ImportToolbox(r"c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Data Management Tools.tbx") | ||
|
||
# Process: Add Fields (multiple) (Add Fields (multiple)) (management) | ||
tracts_trim_2_ = arcpy.management.AddFields(in_table=NHGIS_Census_Boundaries, field_description=[["orig_area", "DOUBLE", "", "", "", ""], ["new_area", "DOUBLE", "", "", "", ""], ["Perc", "DOUBLE", "", "", "", ""]])[0] | ||
|
||
# Process: Calculate Geometry Attributes (Calculate Geometry Attributes) (management) | ||
tracts_trim_3_ = arcpy.management.CalculateGeometryAttributes(in_features=tracts_trim_2_, geometry_property=[["orig_area", "AREA_GEODESIC"]], length_unit="", area_unit="SQUARE_MILES_US", coordinate_system="PROJCS[\"USA_Contiguous_Albers_Equal_Area_Conic\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Albers\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-96.0],PARAMETER[\"Standard_Parallel_1\",29.5],PARAMETER[\"Standard_Parallel_2\",45.5],PARAMETER[\"Latitude_Of_Origin\",37.5],UNIT[\"Meter\",1.0]]", coordinate_format="SAME_AS_INPUT")[0] | ||
|
||
# Process: Intersect (Intersect) (analysis) | ||
Intersect_3_ = "C:\\Users\\jmadron\\Documents\\ArcGIS\\Projects\\Census_HOLC\\Census_HOLC.gdb\\Intersect" | ||
arcpy.analysis.Intersect(in_features=[[tracts_trim_2_, ""], [HOLC_Polygons, ""]], out_feature_class=Intersect_3_, join_attributes="ALL", cluster_tolerance="", output_type="INPUT") | ||
|
||
# Process: Calculate Geometry Attributes (2) (Calculate Geometry Attributes) (management) | ||
tracts_trim_4_ = arcpy.management.CalculateGeometryAttributes(in_features=Intersect_3_, geometry_property=[["new_area", "AREA_GEODESIC"]], length_unit="", area_unit="SQUARE_MILES_US", coordinate_system="PROJCS[\"USA_Contiguous_Albers_Equal_Area_Conic\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Albers\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-96.0],PARAMETER[\"Standard_Parallel_1\",29.5],PARAMETER[\"Standard_Parallel_2\",45.5],PARAMETER[\"Latitude_Of_Origin\",37.5],UNIT[\"Meter\",1.0]]", coordinate_format="SAME_AS_INPUT")[0] | ||
|
||
# Process: Calculate Field (Calculate Field) (management) | ||
tracts_trim_5_ = arcpy.management.CalculateField(in_table=tracts_trim_4_, field="Perc", expression="(!new_area! / !orig_area!)", expression_type="PYTHON3", code_block="", field_type="TEXT", enforce_domains="NO_ENFORCE_DOMAINS")[0] | ||
|
||
# Process: Dissolve (Dissolve) (management) | ||
arcpy.management.Dissolve(in_features=Intersect_3_, out_feature_class=Output_Location, dissolve_field=Dissolve_Field_s_, statistics_fields=Statistics_Field_s_, multi_part="MULTI_PART", unsplit_lines="DISSOLVE_LINES") | ||
|
||
if __name__ == '__main__': | ||
# Global Environment settings | ||
with arcpy.EnvManager(scratchWorkspace=r"C:\Users\jmadron\Documents\ArcGIS\Projects\Census_HOLC\Census_HOLC.gdb", workspace=r"C:\Users\jmadron\Documents\ArcGIS\Projects\Census_HOLC\Census_HOLC.gdb"): | ||
HOLC(*argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# Census_HOLC_Research | ||
Census boundary crosswalk with HOLC Polygons | ||
|
||
|
||
This ArcGIS Pro Toolbox and Python script allows you to crosswalk any Census boundaries (County, Tract, Block) with the Home Owner's Loan Corporation Polygons for reasearch analysis. This tool cuts the Census boundaries to the HOLC polygons and calculates a percent of that boundary that falls within the HOLC neighborhood. Assuming equal distribution you can use this percentage to proportion the variable of choice into the graded neighborhood. Below are the field you will need to populate: | ||
|
||
Census Boundaries: Any geospatial census boundaries. Make sure these have a geoid, fips, or nhgis join code. This is used in the dissolve analysis. | ||
HOLC Polygons: This works best with the DSL's Mapping Inequality HOLC Polygons layer. You will need the holc_grade and neighborhood_id field. |