Update zonering to find the right output files

Added taskmap creator to NBS
This commit is contained in:
Riepma
2021-02-15 17:06:09 +01:00
parent c02b232837
commit 101b683daa
9 changed files with 194 additions and 95 deletions

View File

@@ -73,7 +73,7 @@ namespace FarmmapsZonering
return;
}
bool useCreatedCropfield = true;
bool useCreatedCropfield = false;
bool GetWatBal = input.GetWatBal;
bool getVanDerSat = input.GetVanDerSat;
bool StoreVanDerSatStatistics = input.storeVanDerSatStatistics;
@@ -91,7 +91,7 @@ namespace FarmmapsZonering
}
Item cropfieldItem;
if (string.IsNullOrEmpty(_settings.CropfieldItemCode) || input.CreateNewCropfield == true)
if (input.CreateNewCropfield == true) // || string.IsNullOrEmpty(_settings.CropfieldItemCode) ## CHECK IT!!
{
_logger.LogInformation("Creating cropfield");
@@ -103,8 +103,8 @@ namespace FarmmapsZonering
_settings.CropfieldItemCode = cropfieldItem.Code;
SaveSettings(settingsfile);
cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, "Cropfield VRA Zonering", 2020,
@"{ ""type"": ""Polygon"", ""coordinates"": [ [ [ 5.670991253771027, 52.796788997702613 ], [ 5.671526456638633, 52.797291618546666 ], [ 5.671275936147413, 52.797422436717852 ], [ 5.671959173850738, 52.798269302728798 ], [ 5.670649634919365, 52.798778791408822 ], [ 5.671503682048522, 52.799591206957416 ], [ 5.675159003761311, 52.798193567415474 ], [ 5.673029579585948, 52.796024727480535 ], [ 5.670991253771027, 52.796788997702613 ] ] ] }");
//cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, "Cropfield VRA Zonering", 2020,
// @"{ ""type"": ""Polygon"", ""coordinates"": [ [ [ 5.670991253771027, 52.796788997702613 ], [ 5.671526456638633, 52.797291618546666 ], [ 5.671275936147413, 52.797422436717852 ], [ 5.671959173850738, 52.798269302728798 ], [ 5.670649634919365, 52.798778791408822 ], [ 5.671503682048522, 52.799591206957416 ], [ 5.675159003761311, 52.798193567415474 ], [ 5.673029579585948, 52.796024727480535 ], [ 5.670991253771027, 52.796788997702613 ] ] ] }");
_settings.CropfieldItemCode = cropfieldItem.Code;
SaveSettings(settingsfile);
}
@@ -147,19 +147,24 @@ namespace FarmmapsZonering
var inputOneItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
Path.Combine("Data", $"{input.InputItemOne}"), Path.GetFileNameWithoutExtension($"{input.InputItemOne}"));
if (inputOneItem == null) {
if (inputOneItem == null)
{
_logger.LogError("Could not find item for uploaded data");
return;
}
var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
if (inputTwoItem == null) {
_logger.LogError("Could not find item for uploaded data");
return;
}
//var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
// Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
//if (inputTwoItem == null)
//{
// _logger.LogError("Could not find item for uploaded data");
// return;
//}
//var inputOneItem = input.InputItemOne;
//var inputTwoItem = input.InputItemTwo;
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, input.Formula, new Output()
{
@@ -172,12 +177,14 @@ namespace FarmmapsZonering
{
ItemCode = inputOneItem.Code,
LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
},
new InputParameter()
{
ItemCode = inputOneItem.Code,
LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
});
}
//,
//new InputParameter()
//{
// //ItemCode = inputOneItem.Code,
// //LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
//}
);;
_logger.LogInformation("Downloading output");