| [ Web Proxy ] |
| Viewing: https://dataframes.bigquery.dev/reference/api/../api/bigframes.bigquery.st_distance.html | [Back] [Original] |
Section Navigation
Returns the shortest distance in meters between two non-empty
GEOGRAPHY objects.
Examples:
>>> import bigframes as bpd
>>> import bigframes.bigquery as bbq
>>> import bigframes.geopandas
>>> from shapely.geometry import Polygon, LineString, Point
We can check two GeoSeries against each other, row by row.
>>> s1 = bigframes.geopandas.GeoSeries(
... [
... Point(0, 0),
... Point(0.00001, 0),
... Point(0.00002, 0),
... ],
... )
>>> s2 = bigframes.geopandas.GeoSeries(
... [
... Point(0.00001, 0),
... Point(0.00003, 0),
... Point(0.00005, 0),
... ],
... )
>>> bbq.st_distance(s1, s2, use_spheroid=True)
0 1.113195
1 2.22639
2 3.339585
dtype: Float64
We can also calculate the distance of each geometry and a single shapely geometry:
>>> bbq.st_distance(s2, Point(0.00001, 0))
0 0.0
1 2.223902
2 4.447804
dtype: Float64
series (bigframes.pandas.Series | bigframes.geopandas.GeoSeries) A series containing geography objects.
other (bigframes.pandas.Series | bigframes.geopandas.GeoSeries | shapely.Geometry) The series or geometric object to calculate the distance in meters
to form the geography objects in series.
use_spheroid (optional, default False) Determines how this function measures distance. If use_spheroid
is False, the function measures distance on the surface of a perfect
sphere. If use_spheroid is True, the function measures distance
on the surface of the WGS84 spheroid. The
default value of use_spheroid is False.
The Series (elementwise) of the smallest distance between each aligned geometry with other.
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 |