From 5066969e98c79b4b91d8ae3b5fcb3ddac25e5b17 Mon Sep 17 00:00:00 2001 From: Mark van der Wal Date: Thu, 12 Nov 2020 15:49:17 +0100 Subject: [PATCH] zonering most basic flow --- FarmmapsApi/Constants.cs | 1 + .../Data/neo_ndvi-reglone-low-weed.tif | Bin 0 -> 762877 bytes FarmmapsZonering/Data/neo_pg.json | 8 ++++ FarmmapsZonering/Data/neo_pg.zip | Bin 0 -> 1413 bytes FarmmapsZonering/FarmmapsZonering.csproj | 4 ++ FarmmapsZonering/Models/InputParameter.cs | 8 ++++ FarmmapsZonering/Models/Output.cs | 9 ++++ FarmmapsZonering/Models/Settings.cs | 1 - FarmmapsZonering/Services/ZoneringService.cs | 42 +++++++++++++++++ FarmmapsZonering/ZoneringApplication.cs | 43 ++++++++++-------- 10 files changed, 96 insertions(+), 20 deletions(-) create mode 100644 FarmmapsZonering/Data/neo_ndvi-reglone-low-weed.tif create mode 100644 FarmmapsZonering/Data/neo_pg.json create mode 100644 FarmmapsZonering/Data/neo_pg.zip create mode 100644 FarmmapsZonering/Models/InputParameter.cs create mode 100644 FarmmapsZonering/Models/Output.cs diff --git a/FarmmapsApi/Constants.cs b/FarmmapsApi/Constants.cs index ddb8e9c..b8ed6e0 100644 --- a/FarmmapsApi/Constants.cs +++ b/FarmmapsApi/Constants.cs @@ -16,6 +16,7 @@ namespace FarmmapsApiSamples public const string VRAHERBICIDE_TASK = "vnd.farmmaps.task.vraherbicide"; public const string VRAHAULMKILLING_TASK = "vnd.farmmaps.task.vrahaulmkilling"; public const string VRAPLANTING_TASK = "vnd.farmmaps.task.vrapoten"; + public const string VRAZONERING_TASK = "vnd.farmmaps.task.vrazonering"; public const string SATELLITE_TASK = "vnd.farmmaps.task.satellite"; public const string TASKMAP_TASK = "vnd.farmmaps.task.taskmap"; public const string WORKFLOW_TASK = "vnd.farmmaps.task.workflow"; diff --git a/FarmmapsZonering/Data/neo_ndvi-reglone-low-weed.tif b/FarmmapsZonering/Data/neo_ndvi-reglone-low-weed.tif new file mode 100644 index 0000000000000000000000000000000000000000..9dfe81803b8693dfa7cb68324e02341a8ed0dd0f GIT binary patch literal 762877 zcmeI54a_B1dEe*V?_C@6=@wc{tRf8wvZ`;UjevM<^E1iXer6qnctvaV%Oe zv;>IL2tt&^vS@2B7_aTMS=*ZgkXiwaT1%E%Dzys51i5NexvfIoq^VY|)I$26z5Dn+ z`|SD8oilgtov+_Ycb{{fIdkUBIsfN(&&-**@AcQeygF7@)elzH-oa{bKlNAl|J%Ee ze&>OzI&dL<)&91F7t*QR5tshHy+hS6?E4I* z-B17We){n{FR#8Ql{s8hXYV{vy=6cB#r^b0?mtlNZ?0bPs#os+UsZp7|C7$e?8~mK zDn7&OgByPASatiGk5%{FcC32h*N;`to;g-s@vn|mSO2$T)${fRaMR)A)hGYL@#+hU zaKfERA2t5C#q+@aiV(Oxf9jL-&R$x{{G9VGasm`xBcj4)yIEoKYjCM z)z^P{|8sX$edl+p>ZSj#s&4qBs=EF1z3QGH*{hy-!(R35JNBw8KC)L`eeYg%(?8p* zKKayM^@VeL)zja9pgR1@1Jx^TI8eRmT?eWU?Q8PXz81gsdk3m>|KUJ&<^MZSz5ay< zt6Toc!RoFX4_04(@4@PsPadqE_sGHO)lVL*-uBGF>f;9vRcC(aQ1$iK9IC$aHxE@W zegC2AhTl3=-G25^bzk0O#_=88QGyn2v_4WUBwEE6>k5(^z(Xr}hUU&8v zUw-h97w>)I$fqCwzkjsY52f0FKlYoS_`5%F-QnxL@-Ke$Pk!dctFE)cd*`F@iYf(X zO7ElMyghK}?45~D2~m61pZ@*5V`uOD>HW-s3;84G?XSJ$*oFM@V~^jtR~@b{J8zFv z&pU6AR?pwJM^h!2FY7sQ!5%zszqdMc-u}o-j$NMi->Z(Fw^eoGyggW5cHSPUe(=0a zL|Xnk^|8mk?>j&6lh+>l%HMnS|NO)i*WUZ{ul$2+{&d+7|NPqr&Y$1U{rHQn`=O72 z`}${Z{2SN(`U7A8_TTyK_g!oI-~O8~IP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Lqb`a-ipnna(w*JR}IA9FW!1gp? zjLXf3l5gnqHng!lZP2&$?btPt_%=qijlJJ#KkPsQyU{?7Z$qB9p^M$R-+UUZ8>gG?3$4WSZq8(=6W=+t5LOI-u|A`>ATcGtO8Rt+6ax z*hXATH7+=>>1eyJYf>~c9St#-jO9=@5a(-_kMlLlZ#r)qYCq5}ViXNbQvv`tWo@YMYgl$7UciKj5qJima0Jcqk zjEQ5$c+MK|^EFHRxtdR}o43umA31k8f(C}C0b`n3&oiH{V;kc-ym4hr7!x$G)BtQF z7KjBjFjWmabN2MYuQ&L#|62||J=MP8yohr&Fg*=;rdita%%>Uu>5V^Q%9u`F1ID#v zJV3fZ5$9-Nni?>^d7k-ndasMIpXS&zu8iv(G~jvW)36Qw&q4p3!&nyc39jl zsulg7ZSGc$Fcsv4#|HzmDuE{UqncV!l;wNIkpGZ^0PBPQhkRxgIXrYzW|7RAed$m06s;2Yw6lc+T=`EkV ztT|s;Z{Tyd?I?V*@?`Rp+Fx6~{oD7>U$J`9ZPWFCZpy9UiCsTuqm;lJCzBYRi~Oh# z{PZT~!W^LE7#UH*sIVX_w{I_BlYvNU`TRq7b{f9j`z2rH(iA?9g{sE{9xZT*m5HgT zb!4C3_k51N<^1xs_m2zq+2#2%uF<-Dq2_VqjjbKAZ-1GE)VoYHYcg@pF4Hho@^oDz z6Lj~R;#{|a*e?ehiXR#H&U6)ARr>PRg&j}N?tk|4XI;#@0~KuM)4E0F`4oE#=H_$n zn_#V1qR6T1m6+>j$*wK%neXWN#LtWfKY*ex!0I+IQWzL?Q2kJxQPA6G&%szIa=d=J zeW};RKbwMG@-CzX{xQnqK3%@ayf9Yk*>`zyx + + + + diff --git a/FarmmapsZonering/Models/InputParameter.cs b/FarmmapsZonering/Models/InputParameter.cs new file mode 100644 index 0000000..165b085 --- /dev/null +++ b/FarmmapsZonering/Models/InputParameter.cs @@ -0,0 +1,8 @@ +namespace FarmmapsHaulmkilling.Models +{ + public class InputParameter + { + public string ItemCode { get; set; } + public string ItemLayer { get; set; } + } +} \ No newline at end of file diff --git a/FarmmapsZonering/Models/Output.cs b/FarmmapsZonering/Models/Output.cs new file mode 100644 index 0000000..af7b083 --- /dev/null +++ b/FarmmapsZonering/Models/Output.cs @@ -0,0 +1,9 @@ +namespace FarmmapsZonering.Models +{ + public class Output + { + public string Name { get; set; } + public string Quantity { get; set; } + public string Unit { get; set; } + } +} \ No newline at end of file diff --git a/FarmmapsZonering/Models/Settings.cs b/FarmmapsZonering/Models/Settings.cs index 68925ef..c3beb90 100644 --- a/FarmmapsZonering/Models/Settings.cs +++ b/FarmmapsZonering/Models/Settings.cs @@ -3,6 +3,5 @@ namespace FarmmapsHaulmkilling.Models public class Settings { public string CropfieldItemCode { get; set; } - public string SatelliteTaskCode { get; set; } } } \ No newline at end of file diff --git a/FarmmapsZonering/Services/ZoneringService.cs b/FarmmapsZonering/Services/ZoneringService.cs index c55bd6f..5acafe7 100644 --- a/FarmmapsZonering/Services/ZoneringService.cs +++ b/FarmmapsZonering/Services/ZoneringService.cs @@ -1,5 +1,12 @@ +using System; +using System.Threading.Tasks; +using FarmmapsApi.Models; using FarmmapsApi.Services; +using FarmmapsHaulmkilling.Models; +using FarmmapsZonering.Models; using Microsoft.Extensions.Logging; +using static FarmmapsApi.Extensions; +using static FarmmapsApiSamples.Constants; namespace FarmmapsZonering.Services { @@ -16,5 +23,40 @@ namespace FarmmapsZonering.Services _farmmapsApiService = farmmapsApiService; _generalService = generalService; } + + public async Task CreateApplicationMapAsync(Item cropfieldItem, string formula, Output output, params InputParameter[] inputItemCodes) + { + var zoneringTaskRequest = new TaskRequest() {TaskType = VRAZONERING_TASK}; + var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, zoneringTaskRequest); + + await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => + { + var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); + _logger.LogInformation($"Waiting on calculation of application map; Status: {itemTaskStatus.State}"); + if (itemTaskStatus.IsFinished) + tokenSource.Cancel(); + }); + + var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); + if (itemTask.State == ItemTaskState.Error) + { + _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); + return null; + } + + var itemName = $"VRAZonering"; + var applianceMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code, + GEOTIFF_PROCESSED_ITEMTYPE, itemName, + i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) && + i.Name.ToLower().Contains(itemName.ToLower())); + + if (applianceMapItem == null) + { + _logger.LogError("Could not find the VRAZonering geotiff child item under cropfield"); + return null; + } + + return applianceMapItem; + } } } \ No newline at end of file diff --git a/FarmmapsZonering/ZoneringApplication.cs b/FarmmapsZonering/ZoneringApplication.cs index 88e4861..81c5f90 100644 --- a/FarmmapsZonering/ZoneringApplication.cs +++ b/FarmmapsZonering/ZoneringApplication.cs @@ -5,6 +5,7 @@ using FarmmapsApi; using FarmmapsApi.Models; using FarmmapsApi.Services; using FarmmapsHaulmkilling.Models; +using FarmmapsZonering.Models; using FarmmapsZonering.Services; using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -63,7 +64,7 @@ namespace FarmmapsZonering { _logger.LogInformation("Creating cropfield"); cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, "Cropfield VRA Zonering", 2020, - @"{""type"":""Polygon"",""coordinates"":[[[4.617786844284247,52.22533706956424],[4.618642601314543,52.225938364585989],[4.6192153806397,52.22563988897754],[4.619192414656403,52.2256242822442],[4.620306732153958,52.225031745661528],[4.620542019225217,52.22519855319158],[4.621157509147853,52.22487436515405],[4.623387917230182,52.22367660757213],[4.624563444939009,52.22304740241544],[4.624562779355982,52.223046635247019],[4.624534908813479,52.22302596787506],[4.627873021330343,52.221240670658399],[4.627504935938338,52.220104419135129],[4.627324878706837,52.22020569669098],[4.627320696113512,52.22020660117888],[4.626707169518044,52.22053923770041],[4.624700376420229,52.221619047547488],[4.623471571183885,52.22227447969577],[4.623471511010673,52.22227500174403],[4.623468838689317,52.22228052566992],[4.617786844284247,52.22533706956424]]]}"); + @"{ ""type"": ""Polygon"", ""coordinates"": [ [ [ 5.670991253771027, 52.796788997702613 ], [ 5.671526456638633, 52.797291618546666 ], [ 5.671275936147413, 52.797422436717852 ], [ 5.671959173850738, 52.798269302728798 ], [ 5.670649634919365, 52.798778791408822 ], [ 5.671503682048522, 52.799591206957416 ], [ 5.675159003761311, 52.798193567415474 ], [ 5.673029579585948, 52.796024727480535 ], [ 5.670991253771027, 52.796788997702613 ] ] ] }"); _settings.CropfieldItemCode = cropfieldItem.Code; SaveSettings(); } @@ -73,26 +74,30 @@ namespace FarmmapsZonering cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); } - ItemTaskStatus taskStatus; - if (string.IsNullOrEmpty(_settings.SatelliteTaskCode)) + var inputFileName = "neo_ndvi-reglone-low-weed.tif"; + var dataPath = Path.Combine("Data", inputFileName); + var geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath, + Path.GetFileNameWithoutExtension(inputFileName)); + + if (geotiffItem == null) { + _logger.LogError("Could not find item for uploaded data"); + return; + } + + var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, "[0] * 2", new Output() { - _logger.LogInformation("Gathering satellite information for cropfield, this might take a while!"); - taskStatus = await _generalService.RunAndWaitForTask(cropfieldItem, SATELLITE_TASK, null, 20); - - if (taskStatus.State == ItemTaskState.Error) - { - _logger.LogError($"Something went wrong when trying to process satellite data; {taskStatus.Message}"); - return; - } - - _settings.SatelliteTaskCode = taskStatus.Code; - SaveSettings(); - - } - else + Name = "times_2_zonering", + Unit = "n/kg", + Quantity = "Nitrogen" + }, new InputParameter() { - taskStatus = await _farmmapsApiService.GetTaskStatusAsync(_settings.CropfieldItemCode, _settings.SatelliteTaskCode); - } + ItemCode = geotiffItem.Code, + ItemLayer = geotiffItem.Data["layers"][0]["name"].ToString() + }); + + _logger.LogInformation("Downloading output"); + await _farmmapsApiService.DownloadItemAsync(outputItem.Code, + Path.Combine(DownloadFolder, $"times_2_zonering.zip")); } private void LoadSettings()