I have a point Feature Class I am trying to sort. It contains both a "POINT_X" and a "POINT_Y" field. I wish to start from lower left and sort WE_SN. I have a standard license and am therefore limited to a single sort field (excluding shape) while using sort_mgmt(). I therefore am looking to calculate new sort field using "POINT_X" and "POINT_Y". Any suggestions?

Thanks in advance.

Thanks in advance.

You can concatenate the X and Y coodinates in a text field, but you need to ensure the numbers are a standard length and that the decimals align for both coordinates in the same character position. I use a Python expression like this which assigns leading and trailing zeros to maintain character positions for each coordinate for extracting State Plane Coordinates from the points:

Parser: Python

Use Codeblock: checked

Pre-Logic Script Code:

Expression: Output(!Shape.FirstPoint!)

A sample set of output coordinates in sorted order would be:

{6708902.3000}{2298340.4500}

{6708902.3000}{2298640.4500}

{6708982.3000}{2298340.4500}

{6708982.3000}{2298440.4500}

{6708982.3000}{2308440.4500}

{6709002.3000}{2298340.4500}

Every east west position coordinate takes sort priority over the north south coordinates. This will not sort diagonally from the SW corner to the NE corner. Instead, for a given east/west position it gets all south to north ordered positions and then moves east to the next east/west position and gets all south to north points in order at that location, etc.

This field can act as a Join field for an attribute Join in place of a Spatial Join.

Reversing the coordinate order would moves slowly from South to North with every west to east position subsorted before moving to the next position proceeding northerly in an ascending sort.

To do a diagonal sort based on closest distance to the SW corner, you would have to get the minimum X and Y coordinate of all your points to act as a corner position and then do a euclidean distance calculation of length as a third concatenated value in front of the X Y coordinate values. The length would also have to be decimal aligned for every value with leading and trailing zeros. This would result in a sort that fans out from the SW corner. So for the sample points this sort order would be:

{00000.0000}{6708902.3000}{2298340.4500}

{00080.0000}{6708982.3000}{2298340.4500}

{00100.0000}{6709002.3000}{2298340.4500}

{00128.0625}{6708982.3000}{2298440.4500}

{00300.0000}{6708902.3000}{2298640.4500}

{10100.3200}{6708982.3000}{2308440.4500}

A Geographic or Arithmetic angle from the SW corner to each point could be calculated and concatenated at the beginning of the string with decimal alignment. This would cause a radar sweep sort that goes clockwise from northwest to southeast or counterclockwise southwest to northeast from the SW corner. With compliments of the angles or artificial adjustments of the origin axis for the angle of the sweep you could vary the sweep pattern.