AnsweredAssumed Answered

arcpy.Point()- break down array/list/tuple to use as parameter?

Question asked by jbrengel on Jun 8, 2017
Latest reply on Jul 20, 2017 by jbrengel

I have a 2D list: coordlist = [[0.0,0.0], [0.0, 1000.0], [1000.0, 0.0], [1000.0, 1000.0]]


I'd like to figure out a way to add each element of coordlist (e.g. pairs of coordinates- [0.0,0.0]) into the arcpy.Point() class, but arcpy.Point() requires numbers as its inputs (e.g. arcpy.Point(0, 0).  I don't think it can take anything else (e.g. a list in this case).  So, something like arcpy.Point(0, 0) would work fine, but arcpy.Point(coordlist[0]) will give an error since it's a list.


Any ideas on how to break down a list/tuple/array so that you can use it in arcpy.Point() to make point objects?  I tried flattening coordlist and then using a loop, hoping to skip over every other x and y value in the flattened list, but could not figure that code out.


I see this as potentially being pretty useful if you are trying to create a polygon from point objects and you have a large number of potential point objects in a list/array, not just 4 (since you can easily type up 4 point objects).