Skip to content
Advertisement

Numbering sequences from xml according element’s values

The PointNum attribute means the number of coordinates in the chain. The coordinate chain starts at 1 and ends at 1 as well (inside each Parcel element).

However, within the sequences of these points, there is one more inner logic, which must be explicated. This is the logic of full coincidence of the X and Y coordinates. For example:

  • in the sequence within Parcel_ID = 1 there are equal coordinates with PointNum 1 and 4, 5 and 7

  • in the sequence within Parcel_ID = 2 there are equal coordinates with PointNum 1 и 3

GOAL: I need to number these sub-chains also. (in the SequenceNum column)

CODE

Desired output (“SequenceNum” column)

Advertisement

Answer

This might help you. Please note that it works for your example but I can see it failing for cases like…

  1. More than two equal coordinates.
  2. Intertwined coordinates groups.
  3. PointNum attribute jumps (breaks in the ordinal sequence)
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement