GEOS 3.11.1
|
A simple elevation model used to populate missing Z values in overlay results. More...
#include <ElevationModel.h>
Public Member Functions | |
ElevationModel (const geom::Envelope &extent, int numCellX, int numCellY) | |
void | add (const geom::Geometry &geom) |
double | getZ (double x, double y) |
void | populateZ (geom::Geometry &geom) |
Computes Z values for any missing Z values in a geometry, using the computed model. More... | |
Static Public Member Functions | |
static std::unique_ptr< ElevationModel > | create (const geom::Geometry &geom1, const geom::Geometry &geom2) |
static std::unique_ptr< ElevationModel > | create (const geom::Geometry &geom1) |
Protected Member Functions | |
void | add (double x, double y, double z) |
A simple elevation model used to populate missing Z values in overlay results.
The model divides the extent of the input geometry(s) into an NxM grid. The default grid size is 3x3. If the input has no extent in the X or Y dimension, that dimension is given grid size 1. The elevation of each grid cell is computed as the average of the Z values of the input vertices in that cell (if any). If a cell has no input vertices within it, it is assigned the average elevation over all cells.
If no input vertices have Z values, the model does not assign a Z value.
The elevation of an arbitrary location is determined as the Z value of the nearest grid cell.
An elevation model can be used to populate missing Z values in an overlay result geometry.
double geos::operation::overlayng::ElevationModel::getZ | ( | double | x, |
double | y | ||
) |
Gets the model Z value at a given location. If the location lies outside the model grid extent, this returns the Z value of the nearest grid cell. If the model has no elevation computed (i.e. due to empty input), the value is returned as a double NaN.
x | the x ordinate of the location |
y | the y ordinate of the location |
void geos::operation::overlayng::ElevationModel::populateZ | ( | geom::Geometry & | geom | ) |
Computes Z values for any missing Z values in a geometry, using the computed model.
If the model has no Z value, or the geometry coordinate dimension does not include Z, no action is taken.
geom | the geometry to elevate |