AnsweredAssumed Answered

Issues creating a polygon by reading its geometry

Question asked by Ernestocd on Jan 19, 2017
Latest reply on Jan 19, 2017 by Ernestocd

Need to print the polygon coordinates as one single line text string instead of multi-line. This output will be used as a variable to generate the polygon later in the code. NOTE: The geometry in the searchCursor is a polygon.

for row in arcpy.da.SearchCursor("countAddrPnts_lyr", ["OID@", "SHAPE@", "SITUS_STREET_NUMBER_END2", "SITUS_STREET_NUMBER2"]):x = 0for part in row[1]:    for pnt in part:        if pnt:            pntArray = ("arcpy.Point(" + "{}, {}".format(pnt.X, pnt.Y) + "),")            print pntArray     x += 1

The current output looks like this:

arcpy.Point(907781.079669, 628629.095669),arcpy.Point(907782.765669, 628579.116669),arcpy.Point(907649.596669, 628574.910669),arcpy.Point(907647.068669, 628649.878669),arcpy.Point(907780.236669, 628654.092669),arcpy.Point(907781.079669, 628629.095669),

I need it to look as follows:

arcpy.Point(907781.079669, 628629.095669), arcpy.Point(907782.765669, 628579.116669), arcpy.Point(907649.596669, 628574.910669), arcpy.Point(907647.068669, 628649.878669), arcpy.Point(907780.236669, 628654.092669), arcpy.Point(907781.079669, 628629.095669)

Any suggestions will be appreciated.


arcpy - Issues creating a polygon by reading its geometry - Geographic Information Systems Stack Exchange