0

I am trying to find the corner coorindates of a list of latitudes and longitudes I have (shared below) so that I can draw a polygon in Python (plotly choropleth). The challenge here is the latitudes and longitudes are scattered all around the map (say within a city in US).

I find a similar post that uses bfs, however, it works only for integer coordinates, and the points have to be in adjacent grids. Other similar posts mostly use open-cv, and doesn't work for lat and lon, unless tweaked appropriately.

Edits:

  1. Seems we can use othagonal complex hull algorithm. However, I could not find any implementations in Python.
# Sample list of latitudes and longitudes 
[
    [-86.496774, 32.344437],
    [-86.717897, 32.402814],
    [-86.814912, 32.340803],
    [-86.890581, 32.502974],
    [-86.917595, 32.664169],
    [-86.71339, 32.661732],
    [-86.714219, 32.705694],
    [-86.413116, 32.707386],
    [-86.411172, 32.409937],
    [-86.496774, 32.344437],
    [-86.577799, 33.765316],
    [-86.759144, 33.840617],
    [-86.953664, 33.815297],
    [-86.954305, 33.844862],
    [-86.96296, 33.844865],
    [-86.963358, 33.858221],
    [-86.924387, 33.909222],
    [-86.793914, 33.952059],
    [-86.685365, 34.05914],
    [-86.692061, 34.092654],
    [-86.599632, 34.119914],
    [-86.514881, 34.25437],
    [-86.45302, 34.259317],
    [-86.303516, 34.099073],
    [-86.332723, 33.986109],
    [-86.370152, 33.93977],
    [-86.325622, 33.940147],
    [-86.377532, 33.861706],
    [-86.577528, 33.801977],
    [-86.577799, 33.765316]
]

Appreciate your help and inputs!

prasanth_ntu
  • 19
  • 1
  • 7
  • 1
    Could you use the [Convex Hull](https://en.wikipedia.org/wiki/Convex_hull)? – DarrylG Sep 15 '22 at 09:36
  • Thanks for the wonderful suggestion @DarryIG. Convex Hull meets most of my requirements (Found implementation in [Scipy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html)). However, it doesn't run through all the corner points as it tries to find the shortest euclidean distance among the points (see example [here](https://en.wikipedia.org/wiki/Convex_hull#/media/File:Convex_hull.png)). What I am looking for is something like [this](https://imgur.com/LmSyjQZ), where we only do steps . – prasanth_ntu Sep 16 '22 at 10:38
  • I found a similar question [here](https://stackoverflow.com/questions/32496421/orthogonal-hull-algorithm). I suppose I am looking for orthogonal complex hull algorithm, and wish there's an existing implementation. – prasanth_ntu Sep 16 '22 at 10:45

0 Answers0