Finding corner coordinates of a polygon (latitudes and longitudes) represented in a 2D array

170 Views Asked by At

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!

0

There are 0 best solutions below