buffer#
- geodesic.boson.buffer(distance=None, distance_field=None, segments=10, search_radius_deg=None, input_collection=None, output_collection=None)[source]#
Buffer the queried geometry.
This middleware will buffer the geometry by a given distance. The distance parameter is the distance in decimal degrees in WGS84 (EPSG:4326) to buffer the geometry. The segments parameter controls the number of segments to use when approximating the buffer. A larger number of segments will result in a smoother buffer but will result in larger geometries.
This middleware is especially useful when combined with the rasterize middleware to create a buffer around points. When rasterizing points with the buffer middleware, the buffer will ensure that the points do not become incredibly small when a high rasterization resolution is used.
- Parameters:
distance (float) – distance to buffer the geometry. Must be in decimal degrees in WGS84 (EPSG:4326) and between 0 and 90 degrees.
distance_field (str) – field in the properties of the feature that contains the distance to buffer the geometry. This field must be in decimal degrees in WGS84 (EPSG:4326) and between 0 and 90 degrees.
segments (int, optional) – number of line segments to use in the polygon when approximating the buffer. For example, points will be buffered with a circle of 10 segments and other interpolated curves will similarly be approximated by 10 or fewer segments. Defaults to 10.
search_radius_deg (float, optional) – Search radius for buffering in degrees. This is used To return features that would intersect the buffer, but are outside of the original query geometry. This is useful when buffering points to ensure that all points that would intersect the buffer are returned. Defaults to None (no search radius applied). Ignored if distance field is provided. Must be between 0 and 90 degrees.
input_collection (str, optional) – name of the input collection to apply transform to. Defaults to None (all collections)
output_collection (str, optional) – name of the virtual collection that the transform will be applied to. Defaults to None (no virtual collection created)
- Returns:
middleware to buffer the queried geometry
- Return type:
Examples
>>> # Add the buffer middleware to a dataset view >>> buffered_ds = ds.view( ... name="buffered-ds", ... middleware=[ ... buffer(distance=0.01, segments=32) ... ] ... )