Select satellite image and assign datalayer

This commit is contained in:
jits
2020-11-13 16:05:59 +01:00
parent e27ccbd8ee
commit b47c9880f2
4 changed files with 244 additions and 211 deletions

View File

@@ -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,6 +82,8 @@ 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, string inputLayerName)
@@ -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"] = inputLayerName; //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);
@@ -136,11 +137,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 +151,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) =>