import arcpy # Create an Array object for the multi-part feature. array = arcpy.Array() # List of lists of coordinates. partList = [['1.0;1.0','1.0;10.0','10.0;10.0','10.0;1.0'],            ['20.0;20.0','20.0;30.0','30.0;30.0','30.0;20.0'],            ['-20.0;-20.0','-20.0;-30.0','-30.0;-30.0','-30.0;-20.0']] # For each part, create a sub-array and populate it with #  point objects for coordList in partList:    # Create an Array object for each part.    sub_array = arcpy.Array()    # For each coordinate set, create a point object and add the x- and    #  y-coordinates to the point object, then add the point object    #  to the array object.    for coordPair in coordList:        x, y = coordPair.split(";")        pnt = arcpy.Point(x,y)        sub_array.add(pnt)    # Add in the first point of the array again to close the polygon boundary    sub_array.add(sub_array.getObject(0))    # Add the sub-array to the main array    array.add(sub_array) # Create a multi-part polygon geometry object using the array object multiPartPolygon = arcpy.Polygon(array) # Use the geometry object to create a feature class arcpy.CopyFeatures_management(multiPartPolygon, "c:/temp/geomTest.shp")
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.