A Python script utilizing ArcPy to automate spatial analysis and attribute mapping for GIS data. This project processes shapefiles to associate risers with parcels and assign the minimum address code to each riser, streamlining geospatial workflows in urban planning and infrastructure management.
The RiserAddressMapper project provides a robust solution for geospatial analysts working with ArcGIS. It leverages ArcPy to perform spatial joins between riser and parcel shapefiles, extract the minimum address code for each riser, and update the riser dataset with these values. This automation enhances efficiency in tasks requiring spatial relationships and attribute aggregation, such as address mapping for utility networks or land management systems.
This project aims to simplify the process of linking geospatial features (risers and parcels) and aggregating attribute data (address codes) in ArcGIS. By automating spatial joins and attribute calculations, it reduces manual effort and ensures accuracy in mapping minimum address codes to risers, making it valuable for GIS professionals in urban development, infrastructure planning, or similar fields.
The script (riser_address_mapper.py
) performs the following tasks:
- Configures the ArcGIS workspace to manage input and output files.
- Loads two shapefiles: one for risers and one for parcels.
- Executes a spatial join to identify parcels within each riser.
- Calculates the minimum address code for each riser using a cursor-based approach.
- Creates a new table to store riser codes and their corresponding minimum address codes.
- Joins the minimum address codes back to the original riser shapefile.
- Saves the updated riser dataset as a new shapefile for further analysis or visualization.
- ArcGIS Pro or ArcMap with a valid license and ArcPy module.
- Python environment compatible with ArcGIS (e.g., Python 3.x for ArcGIS Pro or Python 2.7 for ArcMap).
- Input shapefiles:
- Riser shapefile with a unique identifier field (e.g.,
Riser_Code
). - Parcel shapefile with an address code field (e.g.,
Address_Code
).
- Riser shapefile with a unique identifier field (e.g.,
- A workspace directory with read/write permissions for storing input and output files.
- Ensure ArcGIS Pro or ArcMap is installed and ArcPy is accessible in your Python environment.
- Clone the repository to your local machine:
git clone https://github.com/your-username/RiserAddressMapper.git
- Place the required shapefiles in your workspace directory (e.g.,
E:/Projects/Babayi/FinalSHP
). - Verify that both shapefiles share the same Coordinate Reference System (CRS) to ensure accurate spatial analysis.
- Navigate to the repository folder:
cd RiserAddressMapper
- Modify the workspace path in
riser_address_mapper.py
to match your directory:arcpy.env.workspace = "E:/Your/Path/To/FinalSHP"
- Execute the script in an ArcGIS-compatible Python environment (e.g., ArcGIS Pro Python Console or ArcMap Python Window):
python riser_address_mapper.py
- Review the output files generated in the workspace directory for analysis or visualization in ArcGIS.
- Input Files:
- Riser shapefile: Contains riser features with a unique identifier (e.g.,
Riser_Code
). - Parcel shapefile: Contains parcel features with an address code (e.g.,
Address_Code
).
- Riser shapefile: Contains riser features with a unique identifier (e.g.,
- Output Files:
Riser_Parcel_SpatialJoin.shp
: Intermediate shapefile from the spatial join.MinAddrTbl.dbf
: Table storing riser codes and their minimum address codes.Riser_Final_Output.shp
: Final shapefile with risers updated to include minimum address codes.
- Note: Ensure field names in the shapefiles match those specified in the script. Adjust field names (e.g.,
Riser_Asse
,Address_Co
) if necessary.
Contributions are encouraged to enhance the script or add new features. To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Implement changes with clear documentation and comments.
- Submit a pull request describing the updates.
MIT License