Created separate project for areaConversion VRA poten

Updated VRA poten sample code
This commit is contained in:
Riepma
2021-02-16 09:46:50 +01:00
parent 101b683daa
commit 3ad594d83f
14 changed files with 783 additions and 89 deletions

View File

@@ -58,8 +58,6 @@ namespace FarmmapsVRApoten
var variation = input.Variation;
var fieldName = input.FieldName;
bool useShadow = input.UseShadow;
bool convertToCountPerArea = input.ConvertToCountPerArea;
float rijBreedte_m = input.Rijbreedte_m;
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
if (myDrive == null) {
@@ -93,18 +91,6 @@ namespace FarmmapsVRApoten
Path.Combine(DownloadFolder, $"{input.OutputFileName}.shadow.zip"));
}
//Calculating AHN map
_logger.LogInformation("retreiving AHN map for field");
var AHNItem = await _generalService.RunAhnTask(cropfieldItem);
if (AHNItem == null)
{
_logger.LogError("Something went wrong while obtaining the AHN map");
return;
}
_logger.LogInformation("Downloading AHN map");
await _farmmapsApiService.DownloadItemAsync(AHNItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}_AHN.zip"));
_logger.LogInformation("Looking for local data to use");
var localDataAvailable = input.File;
@@ -185,23 +171,14 @@ namespace FarmmapsVRApoten
? "Download application map completed."
: "Something went wrong while downloading.");
// if convertToCountPerArea == True, than recalculate pootafstand in cm to # of poters/m2 from the geotiffItem with the use of the zoneringsTask
if (convertToCountPerArea)
{
applianceMapItem =
await _potenService.ConvertToCountPerAreaTroughZonering(cropfieldItem, applianceMapItem, input.Rijbreedte_m);
}
//GEOTIFF TO Taskmap
_logger.LogInformation($"Converting geotiff to taskmap");
var taskmap = await _generalService.CreateTaskmap(applianceMapItem, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None),
var taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None),
input.EndPoint.ToString(Formatting.None), input.Angle);
if (taskmap == null)
{
_logger.LogError("Something went wrong with geotiff to shape transformation");
_logger.LogError("Something went wrong with geotiff to taskmap transformation");
return;
}