Heureka API .NET Documentation
Get results

Get results for a certain layer and a certain date

The example below assumes that you have made a call to the compartment Grow-method, to a certain targetDate (DateTime).

Note: If a queried layer does not exist, an EmptyLayer-object is returned, with LayerVolumePerHa = 0 etc., so there no need to check for null-values.
Get results for a ApiTreeLayerData using the species code
Copy Code
var layerData = compartment.GetState(targetDate).GetLayer(SpeciesCode.PinusSylvestris); 
var volumePinePerHa = layerData.LayerVolumePerHa;
// If more than one layer with species code pine exists, the first one is returned.
// To return a result where a subset of layers has been aggregated, use method SumLayers instead of GetLayer.

 

Get results for a ApiTreeLayerData using the unique layer id
Copy Code
var volumePinePerHa = compartment.GetState(targetDate).GetLayer(layerGuid).LayerVolumePerHa; 

 

The ApiState.SumTrees methods calculates sums and averages for the trees that belong to one or more species groups. Ingrown trees and regenerated trees are included.

Get results for all trees of a certain species group
Copy Code
var speciesGroups = new List<SpeciesGroupCode>() {SpeciesGroupCode.Pine};
var apiState = compartment.GetState(targetDate).SumTrees(speciesGroups);
var volumePinePerHa = apiState.LayerVolumePerHa;

The ApiState.SumLayers method calculates sums and averages for the layers whose LayerSpeciesCode or LayerSpeciesGroupCode is in the argument list you pass to the method. Ingrown trees and regenerated trees are NOT included.

Merge results for more than one ApiTreeLayerData
Copy Code
var speciesGroups = new List<SpeciesGroupCode>() {SpeciesGroupCode.Pine};
var apiState = compartment.GetState(targetDate).SumLayers(speciesGroups);
var volumePinePerHa = apiState.LayerVolumePerHa;

 

Get results for new trees

If a regeneration has been simulated, or new trees have been added from natural ingrowth, these new trees are put in a specific layer called NewTreesLayer. The species code for that layer is undefined ("Unknown"), since it contains trees of different species.

A regeneration is automatically simulated if you have added a final felling and made a growth projection with treatments.

Naturally ingrown trees are removed if final felling occurs. 

Get result for ingrown trees
Copy Code
ApiState results = compartment.GetState(targetDate).NewTreesLayer;
var stemsPerHa = results.LayerStemsPerHa. 
var volPerHa = results.LayerVolumePerHa.