Expand description
Vector operations and geometric algorithms
This module provides comprehensive geometric operations for vector data:
§Core Operations
- Buffer generation (fixed and variable distance)
- Intersection operations
- Union operations
- Difference operations
§Topology Operations
- Overlay analysis (intersection, union, difference, symmetric difference)
- Erase operations (cookie-cutter)
- Split operations (geometry splitting)
§Network Analysis
- Graph structures and building
- Shortest path algorithms (Dijkstra, A*, bidirectional)
- Service area calculation (isochrones)
- Advanced routing with constraints
§Spatial Clustering
- DBSCAN (density-based clustering)
- K-means clustering
- Hierarchical clustering
§Triangulation
- Delaunay triangulation
- Voronoi diagrams
- Constrained Delaunay
§Spatial Joins
- R-tree spatial index
- Nearest neighbor search
- K-nearest neighbors
- Range queries
§Simplification
- Douglas-Peucker algorithm
- Visvalingam-Whyatt algorithm
- Topology-preserving simplification
§Geometric Analysis
- Centroid calculation (geometric and area-weighted)
- Area calculation (planar and geodetic)
- Length measurement (planar and geodetic)
- Distance measurement (Euclidean, Haversine, Vincenty)
- Convex hull computation
§Spatial Predicates
- Contains, Within
- Intersects, Disjoint
- Touches, Overlaps, Crosses
§Validation & Repair
- Geometry validation
- Self-intersection detection
- Duplicate vertex detection
- Spike detection
- Geometry repair (fix orientation, remove duplicates, close rings)
§Coordinate Transformation
- CRS transformation (WGS84, Web Mercator, UTM, etc.)
- Geometry reprojection
§Object Pooling
- Thread-local object pools for Point, LineString, Polygon
- Pooled versions of buffer, union, difference, intersection operations
- Reduces allocations by 2-3x for batch operations
- Automatic return to pool via RAII guards
§Using Object Pooling
use oxigdal_algorithms::vector::{buffer_point_pooled, Point, BufferOptions};
let point = Point::new(0.0, 0.0);
let options = BufferOptions::default();
// Get a pooled polygon - automatically returned to pool when dropped
let buffered = buffer_point_pooled(&point, 10.0, &options)?;
// Use buffered geometry...
// Polygon returned to pool when `buffered` goes out of scopeAll operations use geometry types from oxigdal-core::vector.
Re-exports§
pub use de9im::CoveredByPredicate;pub use de9im::CoversPredicate;pub use de9im::De9im;pub use de9im::Dimension;pub use de9im::EqualsPredicate;pub use de9im::relate;pub use de9im::relate_line_polygon;pub use de9im::relate_point_polygon;pub use de9im::relate_polygons;pub use min_bounds::Circle;pub use min_bounds::RotatedRect;pub use min_bounds::aabb;pub use min_bounds::min_area_rotated_rect;pub use min_bounds::smallest_enclosing_circle;pub use offset::JoinStyle;pub use offset::OffsetOptions;pub use offset::OffsetResult;pub use offset::offset_linestring;pub use offset::offset_polygon_rings;pub use snap_rounding::SnapRoundingOptions;pub use snap_rounding::SnapRoundingResult;pub use snap_rounding::SnappedSegment;pub use snap_rounding::snap_coordinate;pub use snap_rounding::snap_linestring;pub use snap_rounding::snap_round;pub use pool::Pool;pub use pool::PoolGuard;pub use pool::PoolStats;pub use pool::clear_all_pools;pub use pool::get_pool_stats;pub use pool::get_pooled_coordinate_vec;pub use pool::get_pooled_linestring;pub use pool::get_pooled_point;pub use pool::get_pooled_polygon;pub use clipping::ClipOperation;pub use clipping::clip_multi;pub use clipping::clip_polygons;pub use voronoi::PowerCell;pub use voronoi::PowerDiagram;pub use voronoi::PowerDiagramOptions;pub use voronoi::WeightedPoint;pub use voronoi::power_diagram;pub use voronoi::weighted_bisector;pub use generalization::CollapseOptions;pub use generalization::DisplaceOptions;pub use generalization::DisplaceStats;pub use generalization::ExaggerateAnchor;pub use generalization::ExaggerateOptions;pub use generalization::collapse_linestring_to_point;pub use generalization::collapse_polygon_to_point;pub use generalization::displace_points;pub use generalization::displace_polygons_by_centroid;pub use generalization::exaggerate_coord;pub use generalization::exaggerate_linestring;pub use generalization::exaggerate_polygon;pub use generalization::should_collapse_polygon;pub use robust_location::RobustLocationOptions;pub use robust_location::geometric_median;pub use robust_location::geometric_median_3d;pub use robust_location::geometric_median_with_options;pub use robust_location::l1_median;pub use robust_location::spatial_mean;pub use robust_location::weighted_geometric_median;pub use ransac::RansacLineModel;pub use ransac::RansacOptions;pub use ransac::RansacPlaneModel;pub use ransac::RansacResult;pub use ransac::ransac_fit_line;pub use ransac::ransac_fit_plane;
Modules§
- clipping
- Weiler-Atherton polygon clipping engine
- clustering
- Spatial clustering algorithms for point data
- de9im
- DE-9IM (Dimensionally Extended 9-Intersection Model) spatial relationships
- delaunay
- Delaunay triangulation
- generalization
- Map generalization operators following the ICA (International Cartographic Association) taxonomy.
- geodesic
- Karney’s geodesic algorithms for accurate ellipsoidal computations
- min_
bounds - Minimum bounding geometry algorithms.
- network
- Network analysis for geospatial routing and accessibility
- offset
- Line offset (parallel curve) generation for cartographic styling
- pool
- Object pooling for geometry types to reduce allocations
- ransac
- RANSAC robust model fitting (lines and planes).
- robust_
location - Robust spatial location estimators.
- snap_
rounding - Hobby snap rounding for robust geometric operations.
- spatial_
join - Spatial join operations with spatial indexing
- topology
- Topology operations for advanced vector processing
- voronoi
- Voronoi diagram generation
Structs§
- Buffer
Options - Options for buffer operations
- Coordinate
- Coordinate in 2D, 3D, or 4D space
- CrsTransformer
- Transformer for coordinate reference system conversions
- Line
String LineStringgeometry- Multi
Polygon MultiPolygongeometry- Point
- Point geometry
- Polygon
- Polygon geometry
- Repair
Options - Options for geometry repair operations
- Topology
Simplify Options - Options for topology-preserving simplification.
- Validation
Issue - A validation issue found in a geometry
Enums§
- Area
Method - Area calculation method
- Buffer
CapStyle - End cap style for line buffers
- Buffer
Join Style - Join style for line buffers at vertices
- Common
Crs - Common coordinate reference systems
- Distance
Method - Distance calculation method
- Issue
Type - Validation issue type
- Length
Method - Length calculation method
- Segment
Intersection - Intersection result for two line segments
- Severity
- Validation issue severity
- Simplify
Method - Simplification algorithm selection
Traits§
- Contains
Predicate - Trait for geometries that support contains predicate
- Crosses
Predicate - Trait for geometries that support crosses predicate
- Intersects
Predicate - Trait for geometries that support intersects predicate
- Overlaps
Predicate - Trait for geometries that support overlaps predicate
- Touches
Predicate - Trait for geometries that support touches predicate
Functions§
- area
- Computes the area of a geometry
- area_
multipolygon - Computes the area of a multipolygon
- area_
polygon - Computes the area of a polygon
- buffer_
linestring - Generates a buffer around a linestring
- buffer_
linestring_ pooled - Generates a buffer around a linestring using object pooling
- buffer_
point - Generates a circular buffer around a point
- buffer_
point_ pooled - Generates a circular buffer around a point using object pooling
- buffer_
polygon - Generates a buffer around a polygon
- buffer_
polygon_ pooled - Generates a buffer around a polygon using object pooling
- cascaded_
union - Computes cascaded union of multiple polygons
- cascaded_
union_ pooled - Computes cascaded union using object pooling (alias)
- centroid
- Computes the centroid of any geometry type
- centroid_
collection - Computes the centroid of a geometry collection
- centroid_
linestring - Computes the geometric centroid of a linestring
- centroid_
multilinestring - Computes the centroid of a multilinestring
- centroid_
multipoint - Computes the centroid of a multipoint
- centroid_
multipolygon - Computes the centroid of a multipolygon
- centroid_
point - Computes the centroid of a point (returns the point itself)
- centroid_
polygon - Computes the area-weighted centroid of a polygon
- clip_
to_ box - Clips a polygon to a rectangular bounding box
- close_
ring - Closes an unclosed ring by adding the first point at the end
- contains
- Tests if geometry A contains geometry B
- convex_
hull - Computes the convex hull of a set of points
- convex_
hull_ pooled - Computes convex hull and returns as pooled polygon
- crosses
- Tests if one geometry crosses another
- difference_
polygon - Computes the difference of two polygons (poly1 - poly2)
- difference_
polygon_ pooled - Computes difference of two polygons using object pooling
- difference_
polygons - Computes the difference of multiple polygons
- difference_
polygons_ pooled - Computes difference of base polygons with subtract polygons using object pooling
- directed_
hausdorff - Directed Hausdorff distance from
atob. - discrete_
frechet_ distance - Computes the discrete Fréchet distance between two polylines.
- disjoint
- Tests if geometries are disjoint (share no points)
- distance_
point_ to_ linestring - Computes minimum distance from a point to a linestring
- distance_
point_ to_ point - Computes distance between two points
- distance_
point_ to_ polygon - Computes minimum distance from a point to a polygon boundary
- envelope
- Computes the envelope of any geometry type
- envelope_
collection - Computes the envelope of a geometry collection
- envelope_
contains_ point - Checks if an envelope contains a point
- envelope_
intersection - Computes the intersection of two envelopes
- envelope_
linestring - Computes the envelope of a linestring
- envelope_
multilinestring - Computes the envelope of a multilinestring
- envelope_
multipoint - Computes the envelope of a multipoint
- envelope_
multipolygon - Computes the envelope of a multipolygon
- envelope_
point - Computes the envelope of a point
- envelope_
polygon - Computes the envelope of a polygon
- envelope_
union - Computes the union of two envelopes
- envelope_
with_ buffer - Computes expanded envelope with buffer
- envelopes_
intersect - Checks if two envelopes intersect
- erase_
small_ holes - Erases small holes from a polygon
- fix_
self_ intersection - Attempts to fix self-intersecting polygons using a buffer of 0
- hausdorff_
distance - Symmetric Hausdorff distance between two point sets / polylines.
- hausdorff_
distance_ to_ segments - Hausdorff distance where each point is compared to the nearest segment in the opposing polyline rather than the nearest vertex.
- intersect_
linestrings - Computes all intersection points between two linestrings
- intersect_
linestrings_ sweep - Computes all intersection points using Bentley-Ottmann sweep line algorithm
- intersect_
polygons - Computes intersection of two polygons
- intersect_
polygons_ pooled - Computes intersection of two polygons using object pooling
- intersect_
segment_ segment - Computes intersection of two line segments
- intersects
- Tests if geometries intersect (share any points)
- is_
clockwise - Checks if a polygon is oriented clockwise
- is_
counter_ clockwise - Checks if a polygon is oriented counter-clockwise
- length
- Computes the length of a geometry
- length_
linestring - Computes the length of a linestring
- length_
linestring_ 3d - Computes 3D length of a linestring (Euclidean distance including Z coordinate)
- length_
multilinestring - Computes the length of a multilinestring
- merge_
polygons - Merges touching or overlapping polygons
- overlaps
- Tests if geometries overlap (share some but not all points)
- point_
in_ polygon - Checks if a point is inside a polygon using ray casting algorithm
- point_
in_ polygon_ or_ boundary - Tests if a point is inside or on the boundary of a polygon
- point_
on_ polygon_ boundary - Tests if a point is on the boundary of a polygon
- point_
strictly_ inside_ polygon - Tests if a point is strictly inside a polygon (not on boundary)
- remove_
collinear_ vertices - Removes collinear vertices (simplification)
- remove_
duplicate_ vertices - Removes consecutive duplicate vertices
- remove_
spikes - Removes spike vertices (vertices that create a sharp reversal)
- repair_
linestring - Repairs a linestring according to specified options
- repair_
linestring_ with_ options - Repairs a linestring with custom options
- repair_
polygon - Repairs a polygon according to specified options
- repair_
polygon_ with_ options - Repairs a polygon with custom options
- reverse_
ring - Reverses the orientation of a ring
- simplify_
linestring - Simplifies a linestring using the specified algorithm
- simplify_
linestring_ dp - Simplifies a linestring using Douglas-Peucker algorithm
- simplify_
polygon - Simplifies a polygon using the specified algorithm
- simplify_
topology - Simplify a collection of polygons while preserving shared-edge topology.
- simplify_
topology_ with_ options - Simplify a collection of polygons with detailed options.
- symmetric_
difference - Computes the symmetric difference of two polygons
- symmetric_
difference_ pooled - Computes symmetric difference using object pooling
- touches
- Tests if geometries touch (share boundary but not interior)
- transform_
geometry - Transforms a geometry between coordinate reference systems
- transform_
linestring - Transforms a linestring between coordinate reference systems
- transform_
point - Transforms a point between coordinate reference systems
- transform_
polygon - Transforms a polygon between coordinate reference systems
- union_
polygon - Computes union of two polygons
- union_
polygon_ pooled - Computes union of two polygons using object pooling
- union_
polygons - Computes union of multiple polygons (alias for clarity)
- union_
polygons_ pooled - Computes cascaded union of multiple polygons using object pooling
- validate_
geometry - Validates a geometry and returns list of issues
- validate_
linestring - Validates a linestring
- validate_
polygon - Validates a polygon
- within
- Tests if geometry A is within geometry B (inverse of contains)