[GIS] Intersection point of polygon and the line created by two points ArcPy

arcpygeometryintersectionpolygon

I have polygon layer. I selected the most distant vertex from centroid (picture: point A). (How to do that is in the answer here: Select the most distant vertex from polygon's centroid using ArcPy)
What I need to do next is that I have to find intersection point (point B) of the outline of polygon and line created by centroid and the most distant point (line OA).
enter image description here

Best Answer

Field Calculator solution. See first post on how to use:

def getFarPoint(shp,n):
    p=shp.centroid
    g=arcpy.PointGeometry(p)
    l=shp.boundary()
    points=l.getPart(0)
    m=len(points); lMax=0.0
    for i in range(m):
        pN=points.getObject(i)
        d=g.distanceTo(pN)
        if d>lMax:
            lMax=d;pBest=pN
    xC,yC=p.X,p.Y
    xF=pBest.X;yF=pBest.Y
    pBest.X=xC+(xC-xF)
    pBest.Y=yC+(yC-yF)
    L=arcpy.Polyline(arcpy.Array([pBest,p]))
    arcpy.Intersect_analysis([l,L],"in_memory/pnts", "","", "point")
    g = arcpy.Geometry()
    geometryList = arcpy.CopyFeatures_management("in_memory/pnts",g)
    pBest=geometryList[0].getPart(0)
    pick=[pBest.X,pBest.Y]
    return pick[n]
Related Question