Geometric Primitives#
Geometric primitives and spatial algorithms.
This module provides a comprehensive set of geometric primitives (points, lines, polygons) and spatial algorithms. It is built on the Boost.Geometry library and organized into two namespaces based on the coordinate system:
Geographic: For coordinates on the Earth’s surface (Long/Lat). Calculations account for the Earth’s curvature (ellipsoid/sphere).
Cartesian: For planar coordinates (X/Y). Calculations use Euclidean geometry.
Note
The API is symmetrical: both namespaces provide the same classes
(e.g., Point, Polygon) and algorithms (e.g., intersection,
distance), but their internal implementation differs to suit the
coordinate system.
Geographic System#
Geographic (spherical/ellipsoidal) geometry.
Primitives#
Data structures for representing spatial features defined by Longitude and Latitude.
|
A point in geodetic coordinates (longitude, latitude). |
|
A segment in geographic coordinates. |
|
A linestring in geographic coordinates. |
|
A ring (closed linestring) in geographic coordinates. |
|
A box (rectangle) in geographic coordinates. |
|
A polygon in geographic coordinates. |
|
A collection of points in geographic coordinates. |
|
A collection of linestrings in geographic coordinates. |
|
A collection of polygons in geographic coordinates. |
Coordinate Reference Systems#
Classes for managing coordinate conversions and defining the Earth’s shape.
|
Create a coordinate transformation system. |
|
Define a reference ellipsoid for geodetic calculations. |
Spatial Indexing#
R-Tree spatial index implementation for geographic coordinates.
|
Spatial index for geographic longitude/latitude points. |
Algorithms#
Spatial operations and predicates.
|
Calculate the area of a geometric object. |
|
Calculate the azimuth from point1 to point2. |
|
Calculate the centroid of a geometry. |
|
Clears a geometry, removing all points. |
Calculate the closest points between two geometries. |
|
Converts a Geographic geometry to Cartesian coordinates. |
|
Calculates the convex hull of a geometry. |
|
|
Corrects a geometry to make it valid according to OGC rules. |
Checks if the first geometry is covered by the second geometry. |
|
|
Checks if the first geometry crosses the second geometry. |
|
Calculate the curvilinear distance along the geometric object. |
|
Densifies a geometry by adding points along segments. |
Computes the geometric difference between two geometries. |
|
|
Checks if two geometries are disjoint (do not intersect). |
|
Calculate the distance between two geometric objects. |
|
Calculates the envelope (bounding box) of a geometry. |
|
Checks if two geometries are spatially equal. |
Computes the geometric intersection between two geometries. |
|
Checks if two geometries intersect (have at least one point in common). |
|
|
Check if a geometry is empty (contains no points). |
|
Check if a geometry is simple (has no self-intersections). |
|
Check if a geometry is valid according to OGC standards. |
|
Calculate the length of a geometric object. |
Returns a point at the specified distance along a linestring. |
|
|
Checks if two geometries overlap. |
|
Calculates the perimeter of an areal geometry. |
|
Checks if two geometries satisfy a DE-9IM (Dimensionally Extended nine-Intersection Model) relationship mask. |
|
Computes the DE-9IM (Dimensionally Extended nine-Intersection Model) matrix for two geometries. |
|
Reverses the order of points in a geometry. |
|
Simplifies a geometry by removing points based on distance tolerance. |
|
Checks if two geometries touch (have at least one boundary point in common, but no interior points). |
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
|
Transform a geometry to a different geometry type. |
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
|
Transform a geometry to a different geometry type. |
|
Computes the geometric union of two geometries. |
|
Removes consecutive duplicate points from a geometry. |
|
Checks if the first geometry is completely within the second geometry. |
Vectorized Predicates#
Vectorized spatial predicates for geographic geometries.
|
Test if each point in a source geometry is within a container geometry. |
|
Test if each point in a source geometry is covered by a container geometry. |
|
Calculate the distance from each point in a source geometry to a target geometry. |
Distance Strategies#
Strategies for computing geodesic distances on the Earth’s surface.
|
Geodetic calculation strategy. |
Andoyer method |
|
Karney method |
|
Thomas method |
|
Vincenty method (default) |
Cartesian System#
Cartesian (planar) geometry.
Primitives#
Data structures for representing spatial features defined by X and Y coordinates.
|
A point in Cartesian coordinates. |
|
A segment in Cartesian coordinates. |
|
A linestring in Cartesian coordinates. |
|
A ring (closed linestring) in Cartesian coordinates. |
|
A box (rectangle) in Cartesian coordinates. |
|
A polygon in Cartesian coordinates. |
|
A collection of points in Cartesian coordinates. |
|
A collection of linestrings in Cartesian coordinates. |
|
A collection of polygons in Cartesian coordinates. |
Algorithms#
Spatial operations and predicates in Euclidean space.
|
Calculate the area of a geometric object in Cartesian coordinates. |
|
Calculate the azimuth from point1 to point2. |
|
Calculate the buffer of a geometry. |
|
Calculate the centroid of a geometry. |
|
Clears a geometry, removing all points. |
Calculate the closest points between two geometries. |
|
Converts a Cartesian geometry to Geographic coordinates. |
|
Calculates the convex hull of a geometry. |
|
|
Corrects a geometry to make it valid according to OGC rules. |
Checks if the first geometry is covered by the second geometry. |
|
|
Checks if the first geometry crosses the second geometry. |
|
Densifies a geometry by adding points along segments. |
Computes the geometric difference between two geometries. |
|
|
Checks if two geometries are disjoint (do not intersect). |
|
Calculates the distance between two geometries. |
|
Calculates the envelope (bounding box) of a geometry. |
|
Checks if two geometries are spatially equal. |
Computes the geometric intersection between two geometries. |
|
Checks if two geometries intersect (have at least one point in common). |
|
|
Check if a geometry is empty (contains no points). |
|
Check if a geometry is simple (has no self-intersections). |
|
Check if a geometry is valid according to OGC standards. |
|
Calculates the length of a geometry. |
Returns a point at the specified distance along a linestring. |
|
|
Checks if two geometries overlap. |
|
Calculates the perimeter of an areal geometry. |
|
Checks if two geometries satisfy a DE-9IM (Dimensionally Extended nine-Intersection Model) relationship mask. |
|
Computes the DE-9IM (Dimensionally Extended nine-Intersection Model) matrix for two geometries. |
|
Reverses the order of points in a geometry. |
|
Simplifies a geometry using the Douglas-Peucker algorithm. |
|
Checks if two geometries touch (have at least one boundary point in common, but no interior points). |
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
|
Transform a geometry to a different geometry type. |
Transform a geometry to a different geometry type. |
|
Transform a geometry to a different geometry type. |
|
|
Transform a geometry to a different geometry type. |
|
Computes the geometric union of two geometries. |
|
Removes consecutive duplicate points from a geometry. |
|
Checks if the first geometry is completely within the second geometry. |
Vectorized Predicates#
Vectorized spatial predicates for Cartesian geometries.
|
Test if each point in a source geometry is within a container geometry. |
|
Test if each point in a source geometry is covered by a container geometry. |
|
Calculate the distance from each point in a source geometry to a target geometry. |
Buffer Strategies#
Configuration for the buffering algorithm (Cartesian only).
|
Create asymmetric distance strategy |
|
Create symmetric distance strategy |
|
Create flat end strategy |
|
Create rounded end strategy |
|
Create miter join strategy |
|
Create rounded join strategy |
|
Create circular point strategy |
|
Create square point strategy |
|
Create straight side strategy |
Satellite-Specific#
Satellite-specific geometric operations such as swath calculation and crossover finding.
|
Calculate the swath coordinates from the nadir coordinates. |
|
Find crossover point between two satellite half-orbits. |