bigframes.bigquery.st_intersection#

bigframes.bigquery.st_intersection(series:Series|GeoSeries,other:Series|GeoSeries|BaseGeometry)Series[source]#

Returns aGEOGRAPHY that represents the point set intersection of the twoinputGEOGRAPHYs. Thus, every point in the intersection appears in bothgeography_1 andgeography_2.

Note

BigQuery’s Geography functions, likest_intersection, interpret the geometrydata type as a point set on the Earth’s surface. A point set is a setof points, lines, and polygons on the WGS84 reference spheroid, withgeodesic edges. See:https://cloud.google.com/bigquery/docs/geospatial-data

Examples:

>>>importbigframesasbpd>>>importbigframes.bigqueryasbbq>>>importbigframes.geopandas>>>fromshapely.geometryimportPolygon,LineString,Point

We can check two GeoSeries against each other, row by row.

>>>s1=bigframes.geopandas.GeoSeries(...[...Polygon([(0,0),(2,2),(0,2)]),...Polygon([(0,0),(2,2),(0,2)]),...LineString([(0,0),(2,2)]),...LineString([(2,0),(0,2)]),...Point(0,1),...],...)>>>s2=bigframes.geopandas.GeoSeries(...[...Polygon([(0,0),(1,1),(0,1)]),...LineString([(1,0),(1,3)]),...LineString([(2,0),(0,2)]),...Point(1,1),...Point(0,1),...],...index=range(1,6),...)
>>>s10    POLYGON ((0 0, 2 2, 0 2, 0 0))1    POLYGON ((0 0, 2 2, 0 2, 0 0))2             LINESTRING (0 0, 2 2)3             LINESTRING (2 0, 0 2)4                       POINT (0 1)dtype: geometry
>>>s21    POLYGON ((0 0, 1 1, 0 1, 0 0))2             LINESTRING (1 0, 1 3)3             LINESTRING (2 0, 0 2)4                       POINT (1 1)5                       POINT (0 1)dtype: geometry
>>>bbq.st_intersection(s1,s2)0                                    None1    POLYGON ((0 0, 0.99954 1, 0 1, 0 0))2                       POINT (1 1.00046)3                   LINESTRING (2 0, 0 2)4                GEOMETRYCOLLECTION EMPTY5                                    Nonedtype: geometry

We can also do intersection of each geometry and a single shapely geometry:

>>>bbq.st_intersection(s1,Polygon([(0,0),(1,1),(0,1)]))0    POLYGON ((0 0, 0.99954 1, 0 1, 0 0))1    POLYGON ((0 0, 0.99954 1, 0 1, 0 0))2             LINESTRING (0 0, 0.99954 1)3                GEOMETRYCOLLECTION EMPTY4                             POINT (0 1)dtype: geometry
Parameters:
Returns:

The Geoseries (elementwise) of the intersection of points ineach aligned geometry with other.

Return type:

bigframes.geopandas.GeoSeries

On this page

This Page