update poten app with centered and countPerArea
This commit is contained in:
		| @@ -13,11 +13,13 @@ namespace FarmmapsPoten.Models | ||||
|         public string MeanDensity { get; set; } | ||||
|         public string Variation { get; set; } | ||||
|         public bool UseShadow { get; set; } | ||||
|         public bool CountPerArea { get; set; } | ||||
|         public JObject GeometryJson { get; set; } | ||||
|  | ||||
|         public bool GenerateTaskmap { get; set; } | ||||
|         public string CellWidth { get; set; } | ||||
|         public string CellHeight { get; set; } | ||||
|         public string Centered { get; set; } | ||||
|         public JObject StartPoint { get; set; } | ||||
|         public JObject EndPoint { get; set; } | ||||
|         public string Angle { get; set; } | ||||
|   | ||||
| @@ -58,6 +58,7 @@ namespace FarmmapsVRApoten | ||||
|             var variation = input.Variation; | ||||
|             var fieldName = input.FieldName; | ||||
|             bool useShadow = input.UseShadow; | ||||
|             bool countPerArea = input.CountPerArea; | ||||
|  | ||||
|             var myDrive = roots.SingleOrDefault(r => r.Name == "My drive"); | ||||
|             if (myDrive == null) { | ||||
| @@ -156,7 +157,7 @@ namespace FarmmapsVRApoten | ||||
|  | ||||
|             // INPUT IS NEEDED as GEOTIFF | ||||
|             var applianceMapItem = | ||||
|                 await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation); | ||||
|                 await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea); | ||||
|  | ||||
|             if (applianceMapItem == null) { | ||||
|                 return; | ||||
| @@ -174,8 +175,8 @@ namespace FarmmapsVRApoten | ||||
|              | ||||
|             //GEOTIFF TO Taskmap | ||||
|             _logger.LogInformation($"Converting geotiff to taskmap"); | ||||
|             var taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None),  | ||||
|                 input.EndPoint.ToString(Formatting.None), input.Angle); | ||||
|             var taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.CellWidth, input.CellHeight,  input.StartPoint.ToString(Formatting.None),  | ||||
|                 input.Centered, input.EndPoint.ToString(Formatting.None), input.Angle); | ||||
|             if (taskmap == null) | ||||
|             { | ||||
|                 _logger.LogError("Something went wrong with geotiff to taskmap transformation"); | ||||
|   | ||||
| @@ -7,6 +7,7 @@ | ||||
|         "MeanDensity": "30", | ||||
|         "Variation": "20", | ||||
|         "UseShadow": false, | ||||
|         "CountPerArea": true, | ||||
|         "geometryJson": { | ||||
|             "type": "Polygon", | ||||
|             "coordinates": [ | ||||
| @@ -23,13 +24,20 @@ | ||||
|         "GenerateTaskmap": true, | ||||
|         "CellWidth": "3", | ||||
|         "CellHeight": "10", | ||||
|         "Centered": "true", | ||||
|         "StartPoint": { | ||||
|             "type": "Point", | ||||
|             "coordinates": [ 5.66886041703652044, 52.52929999060298627 ] | ||||
|             //"coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1 | ||||
|             //"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2 | ||||
|             //"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3 | ||||
|             "coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4 | ||||
|         }, | ||||
|         "EndPoint": { | ||||
|             "type": "Point", | ||||
|             "coordinates": [ 5.6716230923214912, 52.52946316399909676 ] | ||||
|             "coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1 | ||||
|             //"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2 | ||||
|             //"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3 | ||||
|             //"coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4 | ||||
|         } // if no angle | ||||
|          | ||||
|         //"Angle": "317.0" // if no endpoint | ||||
|   | ||||
| @@ -25,13 +25,14 @@ namespace FarmmapsVRApoten | ||||
|             _generalService = generalService; | ||||
|         } | ||||
|  | ||||
|         public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation) | ||||
|         public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea) | ||||
|         { | ||||
|             var potenApplicationMapRequest = new TaskRequest()  { TaskType = VRAPLANTING_TASK }; | ||||
|             if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; } | ||||
|             potenApplicationMapRequest.attributes["meanDensity"] = meanDensity; | ||||
|             potenApplicationMapRequest.attributes["variation"] = variation; | ||||
|  | ||||
|             potenApplicationMapRequest.attributes["variation"] = variation; | ||||
|             potenApplicationMapRequest.attributes["countPerArea"] = countPerArea.ToString(); | ||||
|  | ||||
|             var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest); | ||||
|             _logger.LogInformation($"itemTaskCode: {taskCode}"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user