added layer specification VRApoten

This commit is contained in:
Riepma 2021-04-14 20:53:26 +02:00
parent 7baf16db74
commit 1ddafc6d87
4 changed files with 14 additions and 7 deletions

View File

@ -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; }

View File

@ -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;

View File

@ -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",

View File

@ -25,7 +25,7 @@ namespace FarmmapsVRApoten
_generalService = generalService;
}
public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea, bool useShadow)
public async Task<Item> 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}");