Sort latitude and longitude coordinates into clockwise ordered quadrilateral

后端 未结 3 734
暗喜
暗喜 2020-12-13 00:54

Problem

Users can provide up to four latitude and longitude coordinates, in any order. They do so with Google Maps. Using Google\'s Polygon

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 01:16

    For those arriving here having a similar problem a year later:

    I do not agree with the chosen answer's bound walk. There is no singular solution to the order even with a given clock direction. The convex hull of the given coordinates eliminates points e and f. These can then be attached anywhere along the path. Objectively, h,e,f,c can be improved to h,f,e,c keeping the direction of the x component consistent - in this case, negative.

    The significance of this makes it impossible to guarantee the inclusion of any map location in the resulted area bounded by the chosen walk.

提交回复
热议问题