Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::ElevationData Class Reference

#include <MElevationData.h>

Public Member Functions

 ElevationData (std::shared_ptr< SystemTicker > systemTicker, std::shared_ptr< TileCacheManager > tileCacheMgr)
 
bool initFromTemplate (const MapTemplate &tpl)
 Add layers from the given template.
 
ElevationResult calcElevation (const BasicGeoTypes::GeoPos &gp, InterpolationMethod interpolationMethod, double resolution=0.0, long timeout_ms=0, ElevationDataType queryType=ElevationDataType::Undefined)
 Calculate the elevation in a geographical point. This method will calculate the elevation in a given point given certain query parameters. The method will block until a result is given or the timeout limit is reached.
 
ElevationResult calcElevation (const BasicGeoTypes::GeoPos &gp, const ElevationQueryParams &query)
 
std::vector< ElevationResultcalcElevations (const BasicGeoTypes::GeoPos &gp, const ElevationQueryParams &query)
 
bool calcElevation (const BasicGeoTypes::GeoPos &gp, InterpolationMethod interpolationMethod, double &value, double resolution=0.0, long timeout_ms=0)
 Calculate the elevation in a geographical point. This simplified method will calculate the elevation in a given point given certain query parameters. The method will block until a result is given or the timeout limit is reached. Use the ElevationResult version of this method if you need more control of the data result.
 
int getNumElevationLayers () const
 Get number of elevation data layers available.
 
void clearLayers ()
 Clear all data layers.
 
bool getMaxResolution (const BasicGeoTypes::GeoPos &gp, double &maxResolution)
 Get maximum data resolution in a geographical point. This method will check the registered data sets and return the best available data resolution for a certain point. Note that this method uses bounding boxes for the data sets, so there may be cases where the query point is inside the bounding box of a high resolution data set, but no data is available in this point.
 
const std::vector< std::shared_ptr< Maria::ElevationDataLayer > > getElevationLayers () const
 Get a list of all available elevation data layers. There is one data layer for each input data set. These layers may have different projection and resolution.
 
std::shared_ptr< STK::ImagecreateElevationMap (const std::shared_ptr< RasterProjector > &pj, const BasicGeoTypes::PointDXY &topLeft, int width, int height, InterpolationMethod interpolationMethod, long timeout_ms=0, ElevationDataType queryType=ElevationDataType::Undefined)
 Create an elevation raster for a given area. This method will create a georeferenced raster with elevation data samples for a specified area and resolution.
 
std::shared_ptr< STK::ImagecreateElevationMap (const std::shared_ptr< RasterProjector > &pj, const BasicGeoTypes::PointDXY &topLeft, int width, int height, const ElevationQueryParams &query)
 
std::shared_ptr< Maria::ElevationDataLayergetElevationLayer (int layerId) const
 Get elevation data layer by layerID.
 
std::shared_ptr< STK::ImagecreateNormalMap (const std::shared_ptr< RasterProjector > &pj, const BasicGeoTypes::PointDXY &topLeft, int width, int height, InterpolationMethod interpolationMethod, long timeout_ms)
 Create a normal map for a given area. This method will create a georeferenced normal map encoding the surface normals for the given area as RGB data.
 
ElevationMinMaxResult getMinMaxElevation (const std::shared_ptr< RasterProjector > &rp, long timeout_ms)
 Calculate min/max elevation values in a given area. This method will take a geographical area defined by a RasterProjector and calculate the minimum and maximum elevation values inside the area.
 
BasicGeoTypes::GeoPos3D calcSurfaceIntersection (const BasicGeoTypes::GeoPos &pos0, double altitude, double azimuth, double elevation, double step=50, Maria::InterpolationMethod interpolationMethod=Maria::InterpolationMethod::Bilinear, double hTolerance=2.5, double vTolerance=0.0, long timeout_ms=0)
 Calculate intersection point between a 3D ray and the terrain surface. This method will use an iterative algorithm to calculate the intersection point between a ray pointing towards the ground and the terrain surface.
 
BasicGeoTypes::GeoPos3D calcSurfaceIntersection (const BasicGeoTypes::GeoPos3D &pos0, const BasicGeoTypes::GeoPos3D &pos1, double step=50, Maria::InterpolationMethod interpolationMethod=Maria::InterpolationMethod::Bilinear, double hTolerance=2.5, double vTolerance=0.0, long timeout_ms=0)
 Calculate intersection point between a 3D ray and the terrain surface. This method will use an iterative algorithm to calculate the intersection point between a ray pointing towards the ground and the terrain surface.
 
BasicGeoTypes::GeoPos3D calcSurfaceIntersection (const BasicGeoTypes::PointDXYZ &gc0, const BasicGeoTypes::PointDXYZ &dir, double distance, double step, InterpolationMethod interpolationMethod, double hTolerance, double vTolerance, long timeout_ms)
 
Maria::MapMetadata getMetadata (const BasicGeoTypes::GeoRect &grc, double resolution=0.0, long timeout_ms=0)
 Get metdata for the given area.
 
Maria::MapMetadata getMetadata (const BasicGeoTypes::GeoPos &pos, double resolution=0.0, long timeout_ms=0)
 Get metdata for the given point.
 
Maria::MapMetadata getLayerMetadata (int layerId)
 Get metdata for the given layerId.
 

Protected Member Functions

BasicGeoTypes::GeoPos3D refineSurfaceIntersection (const BasicGeoTypes::GeoPos3D &pos0, const BasicGeoTypes::GeoPos3D &pos1, double distance, Maria::InterpolationMethod interpolationMethod, double hTolerance, double vTolerance, long timeout_ms)
 

Protected Attributes

std::shared_ptr< Maria::SystemTicker_systemTicker
 
std::shared_ptr< Maria::TileCacheManager_tileCacheMgr
 
std::vector< std::shared_ptr< Maria::ElevationDataLayer > > _elevationLayer
 
std::shared_mutex _layerMutex
 

Detailed Description

ElevationData - Handle elevation data queries. This class has methods for querying elevation data, both single point values, and areas.

Member Function Documentation

◆ calcElevation() [1/2]

bool Maria::ElevationData::calcElevation ( const BasicGeoTypes::GeoPos gp,
InterpolationMethod  interpolationMethod,
double &  value,
double  resolution = 0.0,
long  timeout_ms = 0 
)
inline

Calculate the elevation in a geographical point. This simplified method will calculate the elevation in a given point given certain query parameters. The method will block until a result is given or the timeout limit is reached. Use the ElevationResult version of this method if you need more control of the data result.

Parameters
gpThe geographical point to query.
interpolationMethodInterpolation method, bilinear or nearest point.
valueOutput elevation data in meters.
resolutionMinimum resolution of the result data in m/sample. If 0, use the highest resolution available.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
Returns
True if a valid elevation was found. False otherwise.

◆ calcElevation() [2/2]

ElevationResult ElevationData::calcElevation ( const BasicGeoTypes::GeoPos gp,
Maria::InterpolationMethod  interpolationMethod,
double  resolution = 0.0,
long  timeout_ms = 0,
ElevationDataType  queryType = ElevationDataType::Undefined 
)

Calculate the elevation in a geographical point. This method will calculate the elevation in a given point given certain query parameters. The method will block until a result is given or the timeout limit is reached.

Parameters
gpThe geographical point to query.
interpolationMethodInterpolation method, bilinear or nearest point.
resolutionMinimum resolution of the result data in m/sample. If 0, use the highest resolution available.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
queryTypeWhich type of elevation data to include in the query. If undefined, any data is used.
Returns
ElevationResult object with elevation value and other information about the resulting sample.

◆ calcSurfaceIntersection() [1/2]

BasicGeoTypes::GeoPos3D ElevationData::calcSurfaceIntersection ( const BasicGeoTypes::GeoPos pos0,
double  altitude,
double  azimuth,
double  elevation,
double  step = 50,
Maria::InterpolationMethod  interpolationMethod = Maria::InterpolationMethod::Bilinear,
double  hTolerance = 2.5,
double  vTolerance = 0.0,
long  timeout_ms = 0 
)

Calculate intersection point between a 3D ray and the terrain surface. This method will use an iterative algorithm to calculate the intersection point between a ray pointing towards the ground and the terrain surface.

Parameters
pos0A 2D geographical start point for the intersection ray.
altitudeAltitude of the start point
azimuthHorizontal direction of the intersection ray. 0 degrees is due north, positive direction is clockwise.
elevationVertical direction of the intersection ray, must be in the interval (0, -180). 0 degrees is parallell with the ground
stepResolution (in meters) of the search along the intersection ray. Shorter interval gives better results, but higher computation time.
interpolationMethodInterpolation method, either bilinear or nearest point.
hToleranceHorizontal error tolerance for the intersection point (meters)
vToleranceMinimum resolution of the terrain data to use for the calculations. 0 means use best available.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
Returns
A 3D geographical point where the ray intersects the ground. If no intersection was found, the returned point is undefined (See GeoPos3D::isValid()).

◆ calcSurfaceIntersection() [2/2]

BasicGeoTypes::GeoPos3D Maria::ElevationData::calcSurfaceIntersection ( const BasicGeoTypes::GeoPos3D pos0,
const BasicGeoTypes::GeoPos3D pos1,
double  step = 50,
Maria::InterpolationMethod  interpolationMethod = Maria::InterpolationMethod::Bilinear,
double  hTolerance = 2.5,
double  vTolerance = 0.0,
long  timeout_ms = 0 
)

Calculate intersection point between a 3D ray and the terrain surface. This method will use an iterative algorithm to calculate the intersection point between a ray pointing towards the ground and the terrain surface.

Parameters
pos0A 3D geographical start point for the intersection ray.
pos0A 3D geographical end point for the intersection ray.
stepResolution (in meters) of the search along the intersection ray. Shorter interval gives better results, but higher computation time.
interpolationMethodInterpolation method, either bilinear or nearest point.
hToleranceHorizontal error tolerance for the intersection point (meters)
vToleranceMinimum resolution of the terrain data to use for the calculations. 0 means use best available.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
Returns
A 3D geographical point where the ray intersects the ground. If no intersection was found, the returned point is undefined (See GeoPos3D::isValid()).

◆ createElevationMap()

std::shared_ptr< STK::Image > ElevationData::createElevationMap ( const std::shared_ptr< RasterProjector > &  pj,
const BasicGeoTypes::PointDXY topLeft,
int  width,
int  height,
Maria::InterpolationMethod  interpolationMethod,
long  timeout_ms = 0,
ElevationDataType  queryType = ElevationDataType::Undefined 
)

Create an elevation raster for a given area. This method will create a georeferenced raster with elevation data samples for a specified area and resolution.

Parameters
pjProjection for the output data set. This will typically be a RasterProjector object.
topLeftUpper left corner in projection coordinates.
widthNumber of samples in X-direction.
heightNumber of samples in Y-direction.
interpolationMethodInterpolation method, either bilinear or nearest point.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
queryTypeWhich type of elevation data to include in the query. If undefined, any data is used.
Returns
Raster image with 32-bit floating point elevation samples.

◆ createNormalMap()

std::shared_ptr< STK::Image > ElevationData::createNormalMap ( const std::shared_ptr< RasterProjector > &  pj,
const BasicGeoTypes::PointDXY topLeft,
int  width,
int  height,
Maria::InterpolationMethod  interpolationMethod,
long  timeout_ms 
)

Create a normal map for a given area. This method will create a georeferenced normal map encoding the surface normals for the given area as RGB data.

Parameters
pjProjection for the output data set. This will typically be a RasterProjector object.
topLeftUpper left corner in projection coordinates.
widthNumber of samples in X-direction.
heightNumber of samples in Y-direction.
interpolationMethodInterpolation method, either bilinear or nearest point.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
Returns
Raster image with normal vector XYZ values encoded as RGB [-1,1] -> [0-255].

◆ getElevationLayer()

std::shared_ptr< Maria::ElevationDataLayer > Maria::ElevationData::getElevationLayer ( int  layerId) const
inline

Get elevation data layer by layerID.

Parameters
layerIdID of the layer to retrieve.
Returns
Elevation data layer or nullptr if not found.

◆ getElevationLayers()

const std::vector< std::shared_ptr< Maria::ElevationDataLayer > > Maria::ElevationData::getElevationLayers ( ) const
inline

Get a list of all available elevation data layers. There is one data layer for each input data set. These layers may have different projection and resolution.

Returns
STL vector with shared pointers to all data layers.

◆ getLayerMetadata()

Maria::MapMetadata Maria::ElevationData::getLayerMetadata ( int  layerId)

Get metdata for the given layerId.

Parameters
layerId
Returns
A map metadata structure containing all metadata fields for the layer.

◆ getMaxResolution()

bool ElevationData::getMaxResolution ( const BasicGeoTypes::GeoPos gp,
double &  maxResolution 
)

Get maximum data resolution in a geographical point. This method will check the registered data sets and return the best available data resolution for a certain point. Note that this method uses bounding boxes for the data sets, so there may be cases where the query point is inside the bounding box of a high resolution data set, but no data is available in this point.

Parameters
gpGeographical location for the query.
maxResolutionOutput maximum resolution in meters/sample.
Returns
True if a data set was found in the query point, false if not.

◆ getMetadata() [1/2]

Maria::MapMetadata Maria::ElevationData::getMetadata ( const BasicGeoTypes::GeoPos pos,
double  resolution = 0.0,
long  timeout_ms = 0 
)

Get metdata for the given point.

Parameters
posPosition to query.
resolutionGet tiles with resolution closest to the given number (in m/pixel). The returned tile will typically be the first quadtree level with resolution better than the required number. If 0, return the highest available resolution.
timeout_msMaximum ms to wait for loading of tiles. If 0, wait indefinitely. If < 0, do not wait, only tiles that are already loaded will be considered.
Returns
A map metadata structure containing all metadata fields for the point, arranged by map data layer. Top layer first.

◆ getMetadata() [2/2]

Maria::MapMetadata Maria::ElevationData::getMetadata ( const BasicGeoTypes::GeoRect grc,
double  resolution = 0.0,
long  timeout_ms = 0 
)

Get metdata for the given area.

Parameters
grcGeographical area to query
resolutionGet tiles with resolution closest to the given number (in m/pixel). The returned tile will typically be the first quadtree level with resolution better than the required number. If 0, return the highest available resolution.
timeout_msMaximum ms to wait for loading of tiles. If 0, wait indefinitely. If < 0, do not wait, only tiles that are already loaded will be considered.
Returns
A map metadata structure containing all metadata fields for the area, arranged by map data layer. Top layer first.

◆ getMinMaxElevation()

ElevationMinMaxResult ElevationData::getMinMaxElevation ( const std::shared_ptr< RasterProjector > &  rp,
long  timeout_ms 
)

Calculate min/max elevation values in a given area. This method will take a geographical area defined by a RasterProjector and calculate the minimum and maximum elevation values inside the area.

Parameters
rpRasterProjector defining a geographical area in some projection.
timeout_msMaximum number of ms to wait for the result. If 0, wait indefinitely.
Returns
Result object containing the minimum and maximum values with their corresponding geographical positions.

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