fixed herbicide sample

This commit is contained in:
Mark van der Wal 2020-06-10 15:24:08 +02:00
parent c8b82a2ed3
commit d1bfd92c78
3 changed files with 7 additions and 2 deletions

View File

@ -56,7 +56,6 @@ namespace FarmmapsApi.Services
public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName) public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName)
{ {
var startUpload = DateTime.UtcNow; var startUpload = DateTime.UtcNow;
var result = await _farmmapsApiService.UploadFile(filePath, root.Code, var result = await _farmmapsApiService.UploadFile(filePath, root.Code,
progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}")); progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}"));

View File

@ -44,7 +44,7 @@ namespace FarmmapsHerbicide
var agents = await _herbicideService.GetHerbicideAgents(); var agents = await _herbicideService.GetHerbicideAgents();
_liberatorTarweAgent = agents.SingleOrDefault(a => a.Name.Equals("Liberator")); _liberatorTarweAgent = agents.SingleOrDefault(a => a.Name.Equals("Liberator"));
await SingleLutumTiffFlow(roots); // await SingleLutumTiffFlow(roots);
await MultiVanDenBorneShapeFlow(roots); await MultiVanDenBorneShapeFlow(roots);
} }

View File

@ -49,9 +49,15 @@ namespace FarmmapsHerbicide
}; };
taskRequest.attributes["inputCode"] = inputItem[0].Code; taskRequest.attributes["inputCode"] = inputItem[0].Code;
taskRequest.attributes["agent"] = JsonConvert.SerializeObject(agent); taskRequest.attributes["agent"] = JsonConvert.SerializeObject(agent);
// check for the layer name
taskRequest.attributes["inputLayerName"] = inputItem[0].Data["layers"][0]["name"].ToString();
if (inputItem.Length > 1) if (inputItem.Length > 1)
{
taskRequest.attributes["extraInputCode"] = inputItem[1].Code; taskRequest.attributes["extraInputCode"] = inputItem[1].Code;
taskRequest.attributes["extraInputLayerName"] = inputItem[1].Data["layers"][0]["name"].ToString();
}
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest); var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest);
await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) =>