grahams-scan

Sort latitude and longitude coordinates into clockwise ordered quadrilateral

Problem Users can provide up to four latitude and longitude coordinates, in any order. They do so with Google Maps. Using Google's Polygon API (v3), the coordinates they select should highlight the selected area between the four coordinates. Question How do you sort an array of latitude and longitude coordinates in (counter-)clockwise...