Constructive Methods: Envelope and Convex Hull
Look at the details of the envelope and convex hull methods.
We'll cover the following
Envelope and convex hull are two useful procedures that allow us to create new geometries based on the extent of the original geometry. Both methods are based on the Shapely library and lie in the category of geometric operations known as constructive methods.
These methods are essential for many geospatial analysis and visualization tasks and can help us gain deeper insights into our data. For example, by using constructive methods like envelope()
and convex_hull()
in GeoPandas, we can create new geometries that represent the boundaries of a feature or a group of features, it helps us to identify clusters of tightly grouped points, point inclusion testing, and so on.
Envelope
The envelope method calculates the minimum bounding box that contains a geometry. The output is a rectangular polygon geometry that represents the envelope. This is often useful when we want to calculate the spatial extent of a dataset or crop a set of geometries to a specific area. For example, we could use the envelope()
method to create a polygon that represents the minimum bounding box of a set of points representing weather stations, and then use that polygon to crop a larger dataset to only include data within that area. Envelopes can be used for any kind of vectorial data (points, lines, or polygons).
Let's visualize the envelope method on different types of geometries. From lines 5 to 7 we create the geometries: Points, LineString, and Polygon. In line 10, we wrap them in a GeoSeries. Then, in line 13, we create the envelopes and then we plot the results.
Get hands-on with 1400+ tech skills courses.