sgsPy
structurally guided sampling
Loading...
Searching...
No Matches

Functions

raster::GDALRasterWrappersgs::poly::poly (vector::GDALVectorWrapper *p_vector, raster::GDALRasterWrapper *p_raster, size_t numStrata, std::string layerName, std::string query, std::string filename, bool largeRaster, std::string tempFolder, std::map< std::string, std::string > driverOptions)

Detailed Description

Function Documentation

◆ poly()

raster::GDALRasterWrapper * sgs::poly::poly ( vector::GDALVectorWrapper * p_vector,
raster::GDALRasterWrapper * p_raster,
size_t numStrata,
std::string layerName,
std::string query,
std::string filename,
bool largeRaster,
std::string tempFolder,
std::map< std::string, std::string > driverOptions )

This function conducts stratification by polygons on the input raster.

First, the spatial reference of the input vector is compared to that of the input raster. If they differ, and error is thrown.

Next, an output raster dataset is created based on the input values. The new raster is created to have the same height, width, geotransform, and projection of the input raster. It may be an in-memory dataset, a VRT dataset, or a dataset corresponding to the user input 'filename' parameter.

The Python function which calls this C++ function created an SQL query which, when ran on the polygon, maps feature values of a particular attribute in a specific layer to stratification values. The GDALRasterize function is called using this SQL query to rasterize the polygon into different stratifications according to the user- defined inputs. One of the parameters to this rasterization function is the output raster dataset created, which has the output of the rasterization written to it's first band.

The resulting dataset is then returned as a GDALRasterWrapper object.

Parameters
GDALVectorWrapper*p_vector
GDALRasterWrapper*p_raster
size_tnumStrata
std::stringlayerName
std::stringquery
std::stringfilename
boollargeRaster
std::stringtempFolder
std::map<std::string,std::string>driverOptions
Returns
GDALRasterWrapper *