GEOS 3.15.0dev
Public Member Functions | Static Public Member Functions | List of all members
geos::operation::grid::GridIntersection Class Reference

The GridIntersection class computes and stores information about intersection of a Grid and a Geometry. For a polygonal geometry, the fraction of each grid cell covered by polygon is stored. For a linear geometry, the length of the line in each grid cell is stored. More...

#include <GridIntersection.h>

Public Member Functions

 GridIntersection (const Grid< bounded_extent > &raster_grid, const geom::Geometry &g, std::shared_ptr< Matrix< float > > cov=nullptr)
 Compute the fraction of each cell in a rectangular grid that is covered by a Geometry. A matrix can be provided to which the fractions will be added.
 
 GridIntersection (const Grid< bounded_extent > &raster_grid, const geom::Envelope &box, std::shared_ptr< Matrix< float > > cov=nullptr)
 Compute the fraction of each cell in a rectangular grid that is covered by an Envelope. A matrix can be provided to which the fractions will be added.
 
std::shared_ptr< Matrix< float > > getResults ()
 Return the intersection result matrix.
 

Static Public Member Functions

static std::unique_ptr< geom::GeometrysubdividePolygon (const Grid< bounded_extent > &p_grid, const geom::Geometry &g, bool includeExterior)
 Partition a polygonal geometry by a grid.
 
static std::shared_ptr< Matrix< float > > getIntersectionFractions (const Grid< bounded_extent > &raster_grid, const geom::Geometry &g)
 
static std::shared_ptr< Matrix< float > > getIntersectionFractions (const Grid< bounded_extent > &raster_grid, const geom::Envelope &box)
 
static geom::Envelope processingRegion (const geom::Envelope &raster_extent, const geom::Geometry &geometry)
 Determines the bounding box of the raster-vector intersection. Considers the bounding boxes of individual polygon components separately to avoid unnecessary computation for sparse multi-polygons.
 

Detailed Description

The GridIntersection class computes and stores information about intersection of a Grid and a Geometry. For a polygonal geometry, the fraction of each grid cell covered by polygon is stored. For a linear geometry, the length of the line in each grid cell is stored.

Intersection information returned as Raster with an equivalent resolution to the input Grid. The spatial extent may be reduced from the input Grid.

Member Function Documentation

◆ processingRegion()

static geom::Envelope geos::operation::grid::GridIntersection::processingRegion ( const geom::Envelope raster_extent,
const geom::Geometry geometry 
)
static

Determines the bounding box of the raster-vector intersection. Considers the bounding boxes of individual polygon components separately to avoid unnecessary computation for sparse multi-polygons.

Parameters
raster_extentEnvelope representing the extent of the vector
geometryGeometry to be processed
Returns
the portion of raster_extent that intersects one or more component_boxes

The documentation for this class was generated from the following file: