I'm working with a DataFrame that has a few thousand coordinate points and am plotting them using plotly.express. I want to draw a marker around the perimeter of the points that encompasses all of the points. I've been using geopandas and the convex_hull function, but it doesn't seem to return the smallest possible polygon.
For example, here's what I have so far:
The black line represents a tracer that was added using go.Scattermapbox to connect the points of the smallest possible polygon selected using the convex_hull function. However, as we can see, it doesn't appear to be the smallest possible polygon? There's a lot of space that is open that could be removed to make the polygon smaller.
Here's the code I've been working with in terms of the convex_hull function:
crs = {'init': 'epsg:4326'}
geo_df = gpd.GeoDataFrame(points, crs=crs)
convex_points = geo_df.unary_union.convex_hull
convex_coords = list(convex_points.exterior.coords)
convex_coords = pd.DataFrame(convex_coords, columns=['lon','lat'])
where the points variable is a DataFrame filled with geometry points that were created using the Point function within shapely.
Am I missing something with convex_hull? Is this truly the smallest possible polygon that the function can return? And if so, is there another option to use to get a smaller possible polygon?
