HAZE
haze is a drop-in replacement to process water vapor to be used with FORCE
Loading...
Searching...
No Matches
STRTree Generation and Usage

Functions

vectorGeometryVectorbuildGEOSGeometriesFromFile (const char *filePath, const char *layerName, const char *inputReferenceSystem)
 Create a vector of GEOS geometries from an OGR-readable vector dataset.
GEOSSTRtree * buildSTRTreefromRaster (const struct averagedData *data, const struct geoTransform *transformation, cellGeometryList **cells)
 Build a STRTree of vectorized raster cells and their values.
void trackIntersectingGeometries (void *item, void *userdata)
 Callback used when querying STRTree.
intersectionVectorquerySTRTree (vectorGeometryVector *areasOfInterest, GEOSSTRtree *rasterTree)
 Query STRTree with MBRs of "extraction" geometries.
GEOSGeometry * boundingBoxOfOGRToGEOS (const OGRGeometryH geom)
 Convert the MBR of an OGR geometry to a GEOS geometry.

Detailed Description

Function Documentation

◆ boundingBoxOfOGRToGEOS()

GEOSGeometry * boundingBoxOfOGRToGEOS ( const OGRGeometryH geom)
nodiscard

Convert the MBR of an OGR geometry to a GEOS geometry.

Note
After the function returns, the caller owns the returned GEOSGeometry object and must free/destroy it after use.
Parameters
geomOGR geometry whose MBR should be converted.
Returns
GEOSGeometry* MBR of input geometry.

◆ buildGEOSGeometriesFromFile()

vectorGeometryVector * buildGEOSGeometriesFromFile ( const char * filePath,
const char * layerName,
const char * inputReferenceSystem )
nodiscard

Create a vector of GEOS geometries from an OGR-readable vector dataset.

This functions opens an OGR-readable vector dataset and extracts a single layer from it. Every feature of the extracted layer is exported to a GEOS geometry and possibly transformed if the layer CRS does not match the one provided in inputReferenceSystem. No attribute information of the layer features is stored/exported.

Remarks
Geometries that don't describe an area or are not the strict 2D version are not allowed and return an error. It's assumed that only one geometry type is associated with each feature.
Note
After the function returns, the caller owns the returned object and musst free it after use.
Parameters
filePathPath to vector dataset.
layerNameLayer to extract. If NULL, the first layer will be used.
inputReferenceSystemTarget CRS in WKT representation.
Returns
vectorGeometryVector* Reference to vector of GEOS geometries, NULL on error.

◆ buildSTRTreefromRaster()

GEOSSTRtree * buildSTRTreefromRaster ( const struct averagedData * data,
const struct geoTransform * transformation,
cellGeometryList ** cells )
nodiscard

Build a STRTree of vectorized raster cells and their values.

This function creates a new STRTree object and inserts vectorized raster cells and their values. The individual cells are also stored in the cells list because the STRTree does not allow to return references to inserted items. GDAL's geo transfromation information is used to derive vectorized cell geometries as per GDAL's documentation. Thus, this function should work well even with non north-up raster datasets as the rotation is honored.

Note
After the function returns, the caller owns the returned GEOSTree object and musst free it after use.
Parameters
dataAveraged data.
transformationExtracted geo transfomation information used to create vectorized cells.
cellsIndirect reference to linked list storing vectorzied geometries. Will not point to valid list on error.
Returns
GEOSSTRtree* Reference to STRTree, NULL on error

◆ querySTRTree()

intersectionVector * querySTRTree ( vectorGeometryVector * areasOfInterest,
GEOSSTRtree * rasterTree )
nodiscard

Query STRTree with MBRs of "extraction" geometries.

This function iterates over all geometries stored in areaOfInterest and queries the previously created STRTree, consisting of vectorized raster cells, for intersections. Any intersecting cells are added to a list and may be used to calculate area weighted means of total water column.

Note
After the function returns, the caller owns the returned object and musst free it after use.
Parameters
areasOfInterestVector of "overlay" geometries used to query STRTree.
rasterTreeSTRTree of vectorized raster cells.
Returns
intersectionVector* Reference to vector connecting "overlay" geometries to intersecting vectorized raster cells.

◆ trackIntersectingGeometries()

void trackIntersectingGeometries ( void * item,
void * userdata )

Callback used when querying STRTree.

Add a new entry to a linked list holding cell geometries. I.e. a list of vectorized raster cells for a given query polygon.

Parameters
itemvoid-casted cellGeometry object whose MBR intersects with MBR of query polygon.
userdatavoid-casted reference to userdata_t.