Update zonering to find the right output files
Added taskmap creator to NBS
This commit is contained in:
		| @@ -107,26 +107,27 @@ namespace FarmmapsApi.Services | ||||
|         } | ||||
|  | ||||
|         // Create taskmap based on width, height and direction | ||||
|         public async Task<Item> CreateTaskmap(Item tiffItem, string cellWidth, string cellHeight, string startPoint, string endPoint = null, string angle = null) | ||||
|         public async Task<Item> CreateTaskmap(Item cropfieldItem, Item tiffItem, string cellWidth, string cellHeight, string startPoint, string endPoint = null, string angle = null) | ||||
|         { | ||||
|             var taskmapRequest = new TaskRequest { TaskType = TASKMAP_TASK }; | ||||
|             taskmapRequest.attributes["inputCode"] = tiffItem.Code; | ||||
|             taskmapRequest.attributes["operation"] = "shape"; // Currently onlye "shape" supported, if ISOXML is supported this should be an input | ||||
|             taskmapRequest.attributes["cellWidth"] = cellWidth; //metres | ||||
|             taskmapRequest.attributes["cellHeight"] = cellHeight; //metres | ||||
|             taskmapRequest.attributes["startPoint"] = startPoint; // Coordinates WGS84 | ||||
|             if (angle == null) taskmapRequest.attributes["endPoint"] = endPoint; // Coordinates WGS84 | ||||
|             if (endPoint == null) taskmapRequest.attributes["angle"] = angle; // degrees between 0.0 and 360.0 | ||||
|  | ||||
|             string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(tiffItem.Code, taskmapRequest); | ||||
|             string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest); | ||||
|  | ||||
|             await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => { | ||||
|                 var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(tiffItem.Code, itemTaskCode); | ||||
|                 var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); | ||||
|                 _logger.LogInformation($"Waiting on conversion to Taskmap; status: {itemTaskStatus.State}"); | ||||
|                 if (itemTaskStatus.IsFinished) | ||||
|                     tokenSource.Cancel(); | ||||
|             }); | ||||
|  | ||||
|             var itemTask = await _farmmapsApiService.GetTaskStatusAsync(tiffItem.Code, itemTaskCode); | ||||
|             var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); | ||||
|             if (itemTask.State == ItemTaskState.Error) | ||||
|             { | ||||
|                 _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user