I am trying to populate the new created point with X, Y coordinates but i have not been successful. The fields it needs to populate on the point feature class is "Point_X" and "Pont_Y". it seems as only "Point_Y" is the only one that gets populated. I also need to take two fields from the parcels ("SiteStreet" & StreetType") and combine them to populate a field from on the point feature layer (StreetName) i am unsure on how to do that.
#import modules import arcpy """ tool box parameters point param = feature set targetpoint = featurelayer parcel = featurelayer """ arcpy.env.qualifiedFieldNames = False point = arcpy.GetParameterAsText(0) #point boolen targetpoint = "CCAP1" #target point feature class parcel = "parcels" #target feature class parcel_lyr = 'parcel_lyr' for prow in arcpy.da.SearchCursor(point,'SHAPE@XY'): x,y = prow[0] del prow point1 = arcpy.Point(x, y) ptGeometry = arcpy.PointGeometry(point1) CC_list = [] with arcpy.da.SearchCursor(targetpoint, ["AddressID"]) as cursor: for row in cursor: try: if "CC" in row[0]: CC_list.append(int(row[0].strip("CC"))) except TypeError: pass del cursor CC_list.sort() AddressID = CC_list[-1] + 1 AddressID = 'CC' + str(AddressID) arcpy.MakeFeatureLayer_management(parcel,parcel_lyr) arcpy.SelectLayerByLocation_management(parcel_lyr,"INTERSECT",ptGeometry) fldList = ['ACCOUNT','OwnerName','SiteAddres','SiteNum','siteNumSfx','Predir','SiteStreet', 'StreetType', 'Postdir', 'SiteCity', 'SiteZip'] fldDict ={} if int(arcpy.GetCount_management(parcel_lyr).getOutput(0))==1: for parrow in arcpy.da.SearchCursor(parcel_lyr,fldList): for x in range(len(fldList)): fldDict[fldList]=parrow del parrow fldAttList = [] for x in range(len(fldList)): fldAttList.append(fldDict[fldList]) manualFields = ["SiteState","FacltyType", "StructType","GIS_STEW", "UpdateBy","Verified", "Status", "StructCat", "APA_CODE","AddressID", "POINT_X", "POINT_Y"] for fld in manualFields: fldList.append(fld) fixedAtts = ["ID","Single Family Home","Primary, Private","CanyonCo", "TA", "Yes, GRM, TA","Active","Residential","1110", AddressID, x, y] for att in fixedAtts: fldAttList.append(att) fldAttList.append(point1) fldtuple = (fldAttList) fldList.append( 'SHAPE@XY') tprow = arcpy.da.InsertCursor(targetpoint, fldList) tprow.insertRow(fldtuple) del tprow
Solved! Go to Solution.
Hi 2CDSD 2C, i am trying to do something very similar to what you are doing with this code. I would like to be able to create multiple points on different parcels at once. the current code only allows you to only create one point. Do you have a copy of this code that will allow for multiple points on different parcels?
I have tried to change the ==1 to >=1 but nothing happened, my python skills are very limited.