Teradata Package for Python Function Reference | 17.10 - spherical_buffer - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference
- Product
- Teradata Package for Python
- Release Number
- 17.10
- Published
- April 2022
- Language
- English (United States)
- Last Update
- 2022-08-19
- lifecycle
- previous
- Product Category
- Teradata Vantage
- teradataml.geospatial.geodataframecolumn.GeoDataFrameColumn.spherical_buffer = spherical_buffer(self, distance, radius=6371000.0)
- DESCRIPTION:
Returns an MBR that represents the minimum and maximum latitude and
longitude of all points within a given distance from a point. The earth
is modeled as a sphere.
Notes:
* spherical_buffer() and spheroidal_buffer() basically perform
the same function, but with different performance and accuracy.
spherical_buffer() models the earth as a simple sphere, so it
performs better than spheroidal_buffer(), but with less accuracy.
spheroidal_buffer() models the earth as a spheroid, so it returns
a more accurate MBR, but it runs slower than spherical_buffer().
* The returned MBR cannot cross the longitude value of +/-180 or the
latitude value of +/-90. The MBR cannot cover more than 180 degrees
of latitude or longitude on the sphere or spheroid.
PARAMETERS:
distance:
Required Argument.
Specifies the distance, in meters, from the point to
calculate the MBR.
Types: float, int, str, ColumnExpression
radius:
Optional Argument.
Specifies the radius of the sphere used to model the earth.
If omitted, the method uses a value of 6371000.0 meters.
Default Value: 6371000.0
Types: float, int, str, ColumnExpression
SUPPORTED GEOMETRY TYPES:
ST_Point
RAISES:
TypeError, ValueError, TeradataMlException
RETURNS:
GeoDataFrameColumn
EXAMPLES:
from teradataml import GeoDataFrame, load_example_data
from teradataml import Point, LineString, Polygon, GeometryCollection
# Load example data.
load_example_data("geodataframe", "sample_shapes")
# Create a GeoDataFrame.
geodf = GeoDataFrame("sample_shapes")
print(geodf)
# Let's select only few columns from GeoDataFrame.
points_df = geodf.select(["skey", "points"])[geodf.skey.isin([1001, 1002, 1003])]
# Example 1: Get an MBR that represents the minimum and maximum latitude and longitude of
# all points within a given distance of 2.8 from a ST_Point in columns 'points'
# with default values for other arguments.
points_df.assign(res = points_df.points.spherical_buffer(distance=2.8))
# Example 2: Get an MBR that represents the minimum and maximum latitude and longitude of
# all points within a given distance of 2.8 and radius as 6371000 from a
# ST_Point in columns 'points' with default values for rest of the arguments.
points_df.assign(res = points_df.points.spherical_buffer(distance=2.8, radius=6371000))