Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Make a feature layer for the neighourhoods
- arcpy.MakeFeatureLayer_management(neighbourhood, "neighbourhoodLayer")
- arcpy.MakeFeatureLayer_management(parcel, "parcelLayerTest1")
- #Setup cursor to update new NBHD field
- with arcpy.da.UpdateCursor(parcel, (parcelIDField,nbhdField)) as parRows:
- for par in parRows:
- # Create a query string for the current patrol zone
- #parcelIDstring = par[0]
- #queryString = '"' + str(parcelIDField) + '" =' + "'" + str(parcelIDstring) + "'"
- #Select parcels based on location contained within neighbourhood
- arcpy.SelectLayerByLocation_management("parcelLayerTest1", "HAVE_THEIR_CENTER_IN", neighbourhood)
- nbhdTable = arcpy.SearchCursor(neighbourhood)
- for nbhd in nbhdTable:
- nbhdValue = nbhd.getValue("Neighbourh")
- if nbhdValue:
- par[1] = nbhdValue
- parRows.updateRow(par)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement