Lab 4 - Dennis
Lab 4 - Dennis
SIN : 22107409
LECTURER : EB
1|Page
INTRODUCTION
Integrating Python scripting into the ArcGIS geospatial software platform provides a robust
method for enhancing and automating a variety of geospatial analysis workflows. Renowned for
its flexibility and user-friendliness, Python is extensively used within the ArcGIS environment to
simplify repetitive tasks, develop custom tools, and boost overall efficiency in geospatial data
processing. By utilizing Python functions, users can create modular and reusable code,
facilitating the management and execution of intricate geoprocessing tasks.
WORKFLOW
TASK 1
1. Opened ArcMap, Loaded the Shapefile(myPoints) and Opened the attribute table, then
added the asked fields(myNumber, myNumRes) as shown below;
2|Page
myNumber myNumRes
2. Populated the myNumber field with random values from 15 – 25 by opening the editor
tool in Arcmap which allows you to edit in the cells.
3|Page
3. Then formulated a function(code) to return myNumRes as an alphabet equivalent of the
number stated in the myNumber field as shown below;
def EVEN_odd(value):
result = ""
if value % 2 == 0:
result = "even"
else:
result = "odd"
return result
4|Page
TASK 2
1. I created my own field(GENDER) and formulated a function which is able to return the
whether the gender is male or female depending on the iType field.
def gender(myType):
result = ""
if myType == 1:
result = "Male"
else:
result = "Female"
return result
CONCLUSION
Python scripting significantly enhances ArcGIS capabilities. By automating repetitive tasks and
creating reusable code, it improves efficiency and problem-solving in geospatial analysis. This
project demonstrates Python's value in handling complex geospatial data, making it an essential
skill for geospatial professionals.
5|Page