Create list of [X, Y] coordinates within field calculator

المشرف العام

Administrator
طاقم الإدارة
Lately i've been working on a script that must calculate a value in ArcGIS field calculator based on all vertex coordinates of a polyline. But i am struggling to create a list of a polylines coordinates whitin the field calculator. The list is not meant to fill the field values, but it make other calculations possible.

This is how the list must be like:

coordinates = [[534359.1787999999, 6944339.3809], [534298.1876999997, 6944310.3992], [534282.0721000005, 6944304.4425]]I have found some material about it on ArcGIS Resource Center, it works when i run their script through the command line and append to a list, but it doesn't work at all in field calculator. I've tried to write a code for the field calculator but it didn't work either, it look like this:

def listCoordinates(shape): coordinatesList = [] n = 0 for pnt in shape.getPart(n): xn = pnt.X yn = pnt.Y coordinatesList.append([xn , yn]) n += 1 return coordinatesList [0]and the expression (this function will be inside another function that return a unique value):

listCoordinates(!shape!) Is this possible? Am i missing something? Any tips will be welcome! :)



أكثر...
 
أعلى