I’m looking for an algorthm for sorting location points (latitude and longitude) from west to east and south to north.
When sorting, the points should be sorted starting in the west and south. When two points are compared, the longitude is compared first. The greater value (more west) point is higher in the list. If the two points have the same longitude, unlikely but possible, the latitudes of the two points are compared. The lowest value (more south) is placed higher in the list.
Does this algorthm exist somewhere? Maybe in C#?
ps- these calculations will be limited to points within the continental United States. There will be no negative latitude / longitude values.
1 Answer