Hi Richard,great! thanks for that. One slight error the if statement should read - if x0 == 0.0 and y0 = =0.0:Very much appreciated!
Hi I wish to calculate the distance between consecutive points in a feature class.I tried using the following code in the "Pre-Logic VBA Script Code" box in the Field Calculator dialog -static x0 as double, y0 as double ' Previous locationdim pPoint as IPointset pPoint = [Shape]x = pPoint.Xy = pPoint.Yd = sqr((x - x0)^2 + (y - y0)^2) ' Distancex0 = xy0 = ybut it doesn't work. Does anyone have any suggestions? Thanks for any help anyone can give me.
x0 = 0.0 y0 = 0.0 def distance(x, y): global x0 global y0 if x0 = 0.0 and y0 = 0.0: x0 = x y0 = y d = math.sqrt((x - x0)**2 + (y - y0)**2) # Distance x0 = x y0 = y return d
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.