| [ Web Proxy ] |
| Viewing: https://dataframes.bigquery.dev/reference/api/bigframes.bigquery.st_centroid.html | [Back] [Original] |
Section Navigation
Computes the geometric centroid of a GEOGRAPHY type.
For POINT and MULTIPOINT types, this is the arithmetic mean of the input coordinates. For LINESTRING and POLYGON types, this is the center of mass. For GEOMETRYCOLLECTION types, this is the center of mass of the collections elements.
Note
BigQuerys Geography functions, like st_centroid, interpret the geometry data type as a point set on the Earths 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_centroid(series)
0 POINT (0.03333 0.06667)
1 POINT (0.49998 0.70712)
2 POINT (0 1)
dtype: geometry
series (bigframes.pandas.Series | bigframes.geopandas.GeoSeries) A series containing geography objects.
A series of geography objects representing the centroids.
Copyright 2019, Google.
Created using Sphinx 8.1.3.
Built with the PyData Sphinx Theme 0.19.0.
| Web Proxy Viewer | New URL | Original Page |