I am looking to compare the first and last point between features in two different feature classes. The features share a common ID. My thought was to create two arrays via FeatureClassToNumPyArray. Then combined them. There is some magic in FeatureClassToNumPyArray where you can use tokens to pull out different geometry parts, but there isnt a token for first or last point. Dan Patterson offers some context, but doesnt address pulling out specific points from a line geometry.

You use the ‘explode to points’ parameter and get the individual points, but only as additional rows and I don’t know if the point order (to determine first and last) is maintained, particularly if I was to pivot the table to it all in one row.

Here is the outline of the final array (or dictionary or list of list etc.) be based on:

[ID,FX1, FY1, FX2, FY2, LX1, LY1, LX2, LY2, DFX, DFY, DLX, DLY]

where F is first point, L is last point, 1&2 are the two feature classes, XY are the coordinates, D is the delta between the two.

The only other way I know to do this is using nested searchcursors and loops to loop through each feature while cracking option the geometry and comparing.

  • 1
    What makes you think that vertices order is not maintaned? I suggest using add geometry tool, that will populate most of the fields you need. – FelixIP Apr 10 '19 at 21:16
  • The tool you mentioned is a script tool which is even, better. I can crack it open and see. – Rex Apr 11 '19 at 15:58
  • @FelixIP I think your comment is a suitable answer. Perhaps add a link to the description/help of the tool and add below, if you would like. – Rex Apr 15 '19 at 21:56
  • Please answer your own question, it's legit. My PC is undergoing maintenance. – FelixIP Apr 15 '19 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.