bigframes.bigquery.st_convexhull#

bigframes.bigquery.st_convexhull(series: Series | GeoSeries) Series[source]#

Computes the convex hull of a GEOGRAPHY type.

The convex hull is the smallest convex set that contains all of the points in the input GEOGRAPHY.

Note

BigQuery’s Geography functions, like st_convexhull, interpret the geometry data type as a point set on the Earth’s surface. A point set is a set of points, lines, and polygons on the WGS84 reference spheroid, with geodesic edges. See: https://cloud.google.com/bigquery/docs/geospatial-data

Examples:

>>> import bigframes.geopandas
>>> import bigframes.pandas as bpd
>>> import bigframes.bigquery as bbq
>>> from shapely.geometry import Polygon, LineString, Point
>>> series = bigframes.geopandas.GeoSeries(
...         [
...             Polygon([(0.0, 0.0), (0.1, 0.1), (0.0, 0.1)]),
...             LineString([(0, 0), (1, 1), (0, 1)]),
...             Point(0, 1),
...         ]
... )
>>> series
0              POLYGON ((0 0, 0.1 0.1, 0 0.1, 0 0))
1                        LINESTRING (0 0, 1 1, 0 1)
2                                       POINT (0 1)
dtype: geometry
>>> bbq.st_convexhull(series)
0    POLYGON ((0 0, 0.1 0.1, 0 0.1, 0 0))
1          POLYGON ((0 0, 1 1, 0 1, 0 0))
2                                POINT (0 1)
dtype: geometry
Parameters:

series (bigframes.pandas.Series | bigframes.geopandas.GeoSeries) – A series containing geography objects.

Returns:

A series of geography objects representing the convex hulls.

Return type:

bigframes.pandas.Series