I'm trying to use the distanceTo() mehtod to return the distance between the centroid of a polygon and a line, but I keep getting this error: "AttributeError: 'Point' object has no attribute 'distanceTo'"
I'm very unfamiliar with working with geometry objects (and I feel like the online help is very unhelpful), but it seems like I'm at least successfully creating a point from the centroid of my study area, as it's printing out as a point with x and y coords, but no z or m coords.
In fact, I'm pretty sure that this is the only correct part of my code so far. I'm not sure if I should be able to run distanceTo() on my line feature layer, or if I need to create a geometry object from the line first, and then try to run the tool.
Anyway, below is my code.
sa = r"Z:\Workspace\GDB.gdb\StudyArea" nrthLine = r"Z:\Workspace\GDB.gdb\NorthLine" arcpy.MakeFeatureLayer_management(nrthLine, "nrthLine_lyr") for row in arcpy.da.SearchCursor(sa, ["SHAPE@XY"]): #returns (x,y) of coordinates x, y = row point = arcpy.Point(x, y) point <Point (6719923.30924, 1985670.0069, #, #)> dis = point.distanceTo("nrthLine_lyr") AttributeError: 'Point' object has no attribute 'distanceTo'
So, in short, can anyone tell me why I'm getting this error, and what needs to be done to fix it, and successfully incorporate my line feature into the distanceTo() method?