From 1ddafc6d8781409280fcd59df3f8b44d994bf6d1 Mon Sep 17 00:00:00 2001 From: Riepma Date: Wed, 14 Apr 2021 20:53:26 +0200 Subject: [PATCH] added layer specification VRApoten --- FarmmapsPoten/Models/PotenInput.cs | 1 + FarmmapsPoten/PotenApplication.cs | 5 ++++- FarmmapsPoten/PotenInput.json | 12 +++++++----- FarmmapsPoten/PotenService.cs | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/FarmmapsPoten/Models/PotenInput.cs b/FarmmapsPoten/Models/PotenInput.cs index 0814ce3..bcf5932 100644 --- a/FarmmapsPoten/Models/PotenInput.cs +++ b/FarmmapsPoten/Models/PotenInput.cs @@ -7,6 +7,7 @@ namespace FarmmapsPoten.Models { public string File { get; set; } + public string InputLayerName { get; set; } public string OutputFileName { get; set; } public string FieldName { get; set; } public int PlantingYear { get; set; } diff --git a/FarmmapsPoten/PotenApplication.cs b/FarmmapsPoten/PotenApplication.cs index 7141f11..8982a9c 100644 --- a/FarmmapsPoten/PotenApplication.cs +++ b/FarmmapsPoten/PotenApplication.cs @@ -59,6 +59,7 @@ namespace FarmmapsVRApoten var fieldName = input.FieldName; bool useShadow = input.UseShadow; bool countPerArea = input.CountPerArea; + var inputLayerName = input.InputLayerName; var myDrive = roots.SingleOrDefault(r => r.Name == "My drive"); if (myDrive == null) { @@ -78,6 +79,8 @@ namespace FarmmapsVRApoten $"VRA Poten cropfield {input.OutputFileName}", input.PlantingYear, input.GeometryJson.ToString(Formatting.None)); + _logger.LogInformation($"CropfielditemCode: {cropfieldItem.Code}"); + //Downloading shadowMap for own interpretation if (useShadow) { _logger.LogInformation("Calculate shadow map for field"); @@ -156,7 +159,7 @@ namespace FarmmapsVRApoten // INPUT IS NEEDED as GEOTIFF var applianceMapItem = - await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea, useShadow); + await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea, useShadow, inputLayerName); if (applianceMapItem == null) { return; diff --git a/FarmmapsPoten/PotenInput.json b/FarmmapsPoten/PotenInput.json index 31ed4e8..3b7a3c1 100644 --- a/FarmmapsPoten/PotenInput.json +++ b/FarmmapsPoten/PotenInput.json @@ -1,12 +1,14 @@ [ + { - "File": "PlantingSampleDataLutum.zip", - "OutputFileName": "2021.04.12_vraPoten_SampleData", + "File": "PlantingSampleDataLutumANDec.zip", + "InputLayerName": "EC0-60", + "OutputFileName": "2021.04.14_vraPoten_SampleDataMultipleLayers", "FieldName": "lutum", "PlantingYear": 2021, "MeanDensity": "30", "Variation": "20", - "UseShadow": true, + "UseShadow": false, "CountPerArea": false, // don't forget to change ddi if isoxml is created "geometryJson": { "type": "Polygon", @@ -22,9 +24,9 @@ }, "GenerateTaskmap": true, - "OutputType": "isoxml", // "shape" or "isoxml" if isoxml also add ddiCode + "OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode "Precision": "2", - "MaximumClasses": "4", + "MaximumClasses": "5", "DdiCode": "0016", "CellWidth": "3", "CellHeight": "10", diff --git a/FarmmapsPoten/PotenService.cs b/FarmmapsPoten/PotenService.cs index b3a6fe0..297f9ea 100644 --- a/FarmmapsPoten/PotenService.cs +++ b/FarmmapsPoten/PotenService.cs @@ -25,7 +25,7 @@ namespace FarmmapsVRApoten _generalService = generalService; } - public async Task CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea, bool useShadow) + public async Task CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea, bool useShadow, string inputLayerName = null) { var potenApplicationMapRequest = new TaskRequest() { TaskType = VRAPLANTING_TASK }; if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; } @@ -34,6 +34,7 @@ namespace FarmmapsVRApoten potenApplicationMapRequest.attributes["variation"] = variation; potenApplicationMapRequest.attributes["countPerArea"] = countPerArea.ToString(); potenApplicationMapRequest.attributes["useShadow"] = useShadow.ToString(); + potenApplicationMapRequest.attributes["inputLayerName"] = inputLayerName; var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest); _logger.LogInformation($"itemTaskCode: {taskCode}");