Skip to main content

buffer_linestring_pooled

Function buffer_linestring_pooled 

Source
pub fn buffer_linestring_pooled(
    line: &LineString,
    distance: f64,
    options: &BufferOptions,
) -> Result<PoolGuard<'static, Polygon>>
Expand description

Generates a buffer around a linestring using object pooling

This is the pooled version of buffer_linestring that reuses allocated polygons from a thread-local pool.

§Arguments

  • line - The linestring to buffer
  • distance - Buffer distance (positive for expansion)
  • options - Buffer options

§Returns

A PoolGuard<Polygon> that automatically returns the polygon to the pool when dropped.

§Errors

Returns error if linestring is invalid or has insufficient points

§Example

use oxigdal_algorithms::vector::{buffer_linestring_pooled, LineString, Coordinate, BufferOptions};

let coords = vec![Coordinate::new_2d(0.0, 0.0), Coordinate::new_2d(10.0, 0.0)];
let line = LineString::new(coords)?;
let options = BufferOptions::default();
let buffered = buffer_linestring_pooled(&line, 5.0, &options)?;