bigframes.bigquery.st_area#
- bigframes.bigquery.st_area(series: Series | GeoSeries) Series[source]#
Returns the area in square meters covered by the polygons in the input GEOGRAPHY.
If geography_expression is a point or a line, returns zero. If geography_expression is a collection, returns the area of the polygons in the collection; if the collection doesn’t contain polygons, returns zero.
Note
BigQuery’s Geography functions, like st_area, 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)]), ... Polygon([(0.10, 0.4), (0.9, 0.5), (0.10, 0.5)]), ... Polygon([(0.1, 0.1), (0.2, 0.1), (0.2, 0.2)]), ... 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 POLYGON ((0.1 0.4, 0.9 0.5, 0.1 0.5, 0.1 0.4)) 2 POLYGON ((0.1 0.1, 0.2 0.1, 0.2 0.2, 0.1 0.1)) 3 LINESTRING (0 0, 1 1, 0 1) 4 POINT (0 1) dtype: geometry
>>> bbq.st_area(series) 0 61821689.855985 1 494563347.88721 2 61821689.855841 3 0.0 4 0.0 dtype: Float64
Use round() to round the outputed areas to the neares ten millions
>>> bbq.st_area(series).round(-7) 0 60000000.0 1 490000000.0 2 60000000.0 3 0.0 4 0.0 dtype: Float64
- Parameters:
series (bigframes.pandas.Series | bigframes.geopandas.GeoSeries) – A series containing geography objects.
- Returns:
Series of float representing the areas.
- Return type: