forked from FarmMaps/FarmMapsApiClient
Eerdere aanpassingen NBS en zonering verwerkt
This commit is contained in:
@@ -74,7 +74,7 @@ namespace FarmmapsNbs
|
||||
var item = await _farmmapsApiService.GetItemAsync(targetNItem.Code);
|
||||
return item.Data.ToObject<TargetNData>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the uptake map based on the given inputs
|
||||
/// </summary>
|
||||
@@ -82,9 +82,11 @@ namespace FarmmapsNbs
|
||||
/// <param name="inputItem"></param>
|
||||
/// <param name="plantingDate">The date the crop is planted</param>
|
||||
/// <param name="measurementDate">The date the measurements are taken</param>
|
||||
/// <param name="inputType">Data type, could be yara, ci, irmi or wdvi</param>
|
||||
/// <param name="inputLayerName">Column name in which the sensor value is stored</param>
|
||||
/// <returns></returns>
|
||||
public async Task<Item> CalculateUptakeMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
|
||||
DateTime measurementDate, string inputType)
|
||||
DateTime measurementDate, string inputType, string inputLayerName)
|
||||
{
|
||||
var nbsUptakeMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
|
||||
nbsUptakeMapRequest.attributes["operation"] = "uptake";
|
||||
@@ -92,10 +94,9 @@ namespace FarmmapsNbs
|
||||
nbsUptakeMapRequest.attributes["plantingDate"] = plantingDate.ToString("o");
|
||||
nbsUptakeMapRequest.attributes["measurementDate"] = measurementDate.ToString("o");
|
||||
nbsUptakeMapRequest.attributes["inputType"] = inputType.ToLower();
|
||||
nbsUptakeMapRequest.attributes["inputLayerName"] = "IRMI"; //toevoeging FS. Kolom IRMI hernoemd als IMI. Deze wordt niet automatisch herkend. En moet dus gespecificeerd worden.
|
||||
if (!(string.IsNullOrEmpty(inputLayerName))) nbsUptakeMapRequest.attributes["inputLayerName"] = inputLayerName;
|
||||
//toevoeging FS. Kolom IRMI hernoemd als IMI. Deze wordt niet automatisch herkend. En moet dus gespecificeerd worden.
|
||||
|
||||
//var layers = inputItem.Data["layers"]; //toevoeging FS, check welke data lagen worden omgezet
|
||||
//_logger.LogInformation($"DataLayers: {layers}"); //toevoeging FS check welke data lagen worden omgezet
|
||||
|
||||
|
||||
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsUptakeMapRequest);
|
||||
@@ -116,9 +117,10 @@ namespace FarmmapsNbs
|
||||
|
||||
var itemName = "VRANbs uptake";
|
||||
var uptakeMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code,
|
||||
GEOTIFF_PROCESSED_ITEMTYPE, itemName,
|
||||
GEOTIFF_PROCESSED_ITEMTYPE, itemName,
|
||||
i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) &&
|
||||
i.Name.ToLower().Contains(itemName.ToLower()));
|
||||
i.Name.ToLower().Contains(itemName.ToLower()));
|
||||
|
||||
if (uptakeMapItem == null)
|
||||
{
|
||||
_logger.LogError("Could not find the uptake geotiff child item under cropfield");
|
||||
@@ -136,11 +138,11 @@ namespace FarmmapsNbs
|
||||
/// <param name="inputItem">The farmmaps item containing the geotiff data</param>
|
||||
/// <param name="plantingDate">The date the crop is planted</param>
|
||||
/// <param name="measurementDate">The date the measurements are taken</param>
|
||||
/// <param name="inputType">The inputtype to use</param>
|
||||
/// <param name="inputType">The inputtype to use, could be yara, ci, irmi or wdvi</param>
|
||||
/// <param name="targetN">The target nitrogen to use for the calculations</param>
|
||||
/// <returns></returns>
|
||||
public async Task<Item> CalculateApplicationMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
|
||||
DateTime measurementDate, string inputType, double targetN)
|
||||
DateTime measurementDate, string inputType, double targetN, string inputLayerName)
|
||||
{
|
||||
var nbsApplicationMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
|
||||
nbsApplicationMapRequest.attributes["operation"] = "application";
|
||||
@@ -150,7 +152,8 @@ namespace FarmmapsNbs
|
||||
nbsApplicationMapRequest.attributes["inputCode"] = inputItem.Code;
|
||||
nbsApplicationMapRequest.attributes["inputType"] = inputType.ToLower();
|
||||
nbsApplicationMapRequest.attributes["targetN"] = targetN.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
if (!(string.IsNullOrEmpty(inputLayerName))) nbsApplicationMapRequest.attributes["inputLayerName"] = inputLayerName;
|
||||
|
||||
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsApplicationMapRequest);
|
||||
|
||||
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
||||
|
Reference in New Issue
Block a user