I feel that I have grown in leaps and bounds this year with my Python and ArcPy coding skills. A big part of this has been the various projects I’ve taken on helping the Pennsylvania South Central Task Force’s (SCTF) GIS Workgroup with its regional data sharing. I’ve also been learning a lot about ArcPy in a summer side-gig developing a Python for ArcGIS workforce course for Harrisburg Area Community College (HACC).
In this post, I want to share a work-around script I developed for a SCTF member county. The script converts their parcel dataset into a pseudo-address points dataset. Previously, the SCTF used the Feature to Point geoprocessing tool to accomplish this task. This tool requires the ArcGIS Desktop Advanced license, and the organization had down-graded the license level. As I have learned a great deal about the ArcPy Data Access module in developing the HACC course, I had an idea that cursors could be used to convert the parcels (polygon geometry) to the address points (point geometry).
Below is a diagram and sample code for the script. I think this is a nice work-around to the license-level limitations the SCTF has.
# allow data to be overwritten each time script is run arcpy.env.overwriteOutput = True # Copy data for features in parcels layer to a list element # list to contain data for each record featuresList =  # parcels layer parcels = r'C:\Geodata\LandBase.gdb\Parcels' # fields from parcels to access in search cursor # SHAPE@TRUECENTROID provides us the centroid coordinates parcelFields = ['SHAPE@TRUECENTROID','PIN','SITEADDR','SITECTY','SITEZIP','MUNI'] # create search cursor to loop over records in parcels layer # and add data to featuresList with arcpy.da.SearchCursor(parcels,parcelFields) as cursor: # row represents a record in the dataset for row in cursor: # append data from each record to a list item in featuresList featuresList.append([row,row,row,row,row,row]) # end for # end with # create empty feature class container for address points # output geodatabase geodatabase = r'S:\Region\RegionData.gdb' # create spatial reference object to define coordinate system for layer # use WKID (well-known ID) sr = arcpy.SpatialReference(2272) # create feature class arcpy.CreateFeatureclass_management(geodatabase,'AddressPoints','POINT',spatial_reference=sr) # variable to store newly created address points addressPoints = r'S:\Region\RegionData.gdb\AddressPoints' # loop through list of fields from parcels layer and add fields to address points layer for field in parcelFields: # skip over item from centroid coordinates if field == 'SHAPE@TRUECENTROID': continue else: arcpy.AddField_management(addressPoints,field,'TEXT') # end if/else # end for # create insert cursor to loop over featuresList and add records for Address Points layer addPtsFields = ['SHAPE@XY','PIN','SITEADDR','SITECTY','SITEZIP','MUNI'] # open insert cursor # because structure/order of fields from parcels cursor matches the address # points, we can simply pass in the list item from featuresList into the layer # cursor with arcpy.da.InsertCursor(addressPoints,addPtsFields) as cursor: for record in featuresList: cursor.insertRow(record) # end for # end with # delete cursor del cursor