small fix

This commit is contained in:
Mark van der Wal 2020-11-12 22:12:31 +01:00
parent 5066969e98
commit f972699fe9
3 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,6 @@ namespace FarmmapsHaulmkilling.Models
public class InputParameter public class InputParameter
{ {
public string ItemCode { get; set; } public string ItemCode { get; set; }
public string ItemLayer { get; set; } public string LayerName { get; set; }
} }
} }

View File

@ -5,6 +5,7 @@ using FarmmapsApi.Services;
using FarmmapsHaulmkilling.Models; using FarmmapsHaulmkilling.Models;
using FarmmapsZonering.Models; using FarmmapsZonering.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using static FarmmapsApi.Extensions; using static FarmmapsApi.Extensions;
using static FarmmapsApiSamples.Constants; using static FarmmapsApiSamples.Constants;
@ -27,6 +28,11 @@ namespace FarmmapsZonering.Services
public async Task<Item> CreateApplicationMapAsync(Item cropfieldItem, string formula, Output output, params InputParameter[] inputItemCodes) public async Task<Item> CreateApplicationMapAsync(Item cropfieldItem, string formula, Output output, params InputParameter[] inputItemCodes)
{ {
var zoneringTaskRequest = new TaskRequest() {TaskType = VRAZONERING_TASK}; var zoneringTaskRequest = new TaskRequest() {TaskType = VRAZONERING_TASK};
zoneringTaskRequest.attributes["formula"] = formula;
zoneringTaskRequest.attributes["inputCode"] = cropfieldItem.Code;
zoneringTaskRequest.attributes["output"] = JsonConvert.SerializeObject(output);
zoneringTaskRequest.attributes["inputs"] = JsonConvert.SerializeObject(inputItemCodes);
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, zoneringTaskRequest); var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, zoneringTaskRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>

View File

@ -92,7 +92,7 @@ namespace FarmmapsZonering
}, new InputParameter() }, new InputParameter()
{ {
ItemCode = geotiffItem.Code, ItemCode = geotiffItem.Code,
ItemLayer = geotiffItem.Data["layers"][0]["name"].ToString() LayerName = geotiffItem.Data["layers"][0]["name"].ToString()
}); });
_logger.LogInformation("Downloading output"); _logger.LogInformation("Downloading output");