feat: add bigframes.bigquery.st_distance function#1637
Conversation
| 4 POINT (0 1) | ||
| dtype: geometry | ||
|
|
||
| Args: |
There was a problem hiding this comment.
Miss series argument here.
| dtype: Float64 | ||
|
|
||
| Args: | ||
| series: |
There was a problem hiding this comment.
nit: add type to the arguments:
series(bigframes.series.Series)
other (bigframes.series.Series or geometric object)
There was a problem hiding this comment.
Good catch. Updated to use | instead of or to reflect Python 3.10+ type checking syntax.
series (bigframes.pandas.Series | bigframes.geopandas.GeoSeries):
A series containing geography objects.
other (bigframes.pandas.Series | bigframes.geopandas.GeoSeries | shapely.Geometry):
| 4 POINT (0 1) | ||
| dtype: geometry | ||
|
|
||
| Args: |
There was a problem hiding this comment.
Missing series argument here.
| # we can. | ||
| @property | ||
| def area(self, crs=None) -> bigframes.series.Series: # type: ignore | ||
| """[Not Implemented] Use ``bigframes.bigquery.st_area(series)``, |
There was a problem hiding this comment.
I'm curious why we cannot implement the similar methods for GeoSeries here?
There was a problem hiding this comment.
It's because BigQuery returns the value in meters, but in GeoPandas, it's based on the native coordinates. We're leaving it as not implemented until we can figure out how to be more "drop in" with regards to support for GeoPandas.
|
|
||
| geobf_s1 = bigframes.geopandas.GeoSeries(data=data1) | ||
| geobf_s2 = bigframes.geopandas.GeoSeries(data=data2) | ||
| geobf_s_result = bbq.st_distance(geobf_s1, geobf_s2).to_pandas() |
There was a problem hiding this comment.
Do we expect st_distance throw an error if two GeoSeries has different numbers of rows? If so, can we try to verify that offline or in a simple test?
There was a problem hiding this comment.
It should not. Instead, it should return null for the mismatched rows but that'd be a good test. Will add some.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕