Merge branch 'master' of https://git.akkerweb.nl/jits/FarmMapsApiClient_WURtest
This commit is contained in:
commit
761221d936
@ -36,8 +36,13 @@ namespace FarmMapsBlight
|
|||||||
taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o");
|
taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o");
|
||||||
taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o");
|
taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o");
|
||||||
|
|
||||||
|
var fungicide1 = "{\"ai1\": \"propamocarb\", \"ai2\": \"fluopicolide\", \"ai3\": \"cymoxanil\", \"code\": \"infinito12curz\", \"name\": \"infinito 1,2 l + curzate partner 0,2 kg\", \"maxdose\": \"1\", \"mindose\": \"1\", \"safedays\": \"14\", \"emergence\": true, \"newgrowth\": \"1\", \"contentai1\": \"525.2\", \"contentai2\": \"62.5\", \"contentai3\": \"600\", \"fastgrowth\": true, \"contentunit\": \"l/ha + kg/ha\", \"rainfastness\": \"2.5\", \"tuberfilling\": true, \"aidescription\": \"(propamocarb + fluopicolide) 1.2 l/ha + cymoxanil 0.2 kg/ha\", \"curativescore\": \"2\", \"dryingtimemax\": \"2\", \"dryingtimemin\": \"2\", \"vracompatible\": false, \"maxapplications\": \"4\", \"preventivescore\": \"3\", \"recommendeddose\": \"1\", \"tuberprotection\": \"3.3\", \"eradicativescore\": \"2\", \"earlytubersetting\": true, \"protectioncategory\": \"2\", \"applicationrateunit\": null, \"ctgbregistrationnumber\": \"12927 n + 12755 n\"}";
|
||||||
|
var fungicide2 = "{\"ai1\": \"fluazinam\", \"ai2\": \"cymoxanil\", \"ai3\": null, \"code\": \"kunshi\", \"name\": \"kunshi\", \"maxdose\": \"0.5\", \"mindose\": \"0.4\", \"safedays\": \"1\", \"emergence\": false, \"newgrowth\": \"1\", \"contentai1\": \"375\", \"contentai2\": \"250\", \"contentai3\": \"0\", \"fastgrowth\": true, \"contentunit\": \"g/kg\", \"rainfastness\": \"2.5\", \"tuberfilling\": false, \"aidescription\": \"(fluazinam + cymoxanil) 0.5 kg/ha\", \"curativescore\": \"2\", \"dryingtimemax\": \"2\", \"dryingtimemin\": \"1\", \"vracompatible\": true, \"maxapplications\": \"5\", \"preventivescore\": \"2.9\", \"recommendeddose\": \"0.5\", \"tuberprotection\": \"3.3\", \"eradicativescore\": \"1\", \"earlytubersetting\": false, \"protectioncategory\": \"1\", \"applicationrateunit\": \"kg/ha\", \"ctgbregistrationnumber\": \"14371 n\"}";
|
||||||
|
|
||||||
List<Spray> sprays = new List<Spray>();
|
List<Spray> sprays = new List<Spray>();
|
||||||
sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 7, 1), dose = 0.6, isVRA = false });
|
sprays.Add(new Spray() { fungicide = JsonConvert.DeserializeObject<Fungicide>(fungicide1), sprayTime = new DateTime(2020, 6, 24), dose = 0.6, isVRA = false });
|
||||||
|
sprays.Add(new Spray() { fungicide = JsonConvert.DeserializeObject<Fungicide>(fungicide2), sprayTime = new DateTime(2020, 7, 2), dose = 0.6, isVRA = false });
|
||||||
|
//sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 7, 1), dose = 0.6, isVRA = false });
|
||||||
taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays);
|
taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays);
|
||||||
|
|
||||||
List<Irrigation> irrigations = new List<Irrigation>();
|
List<Irrigation> irrigations = new List<Irrigation>();
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="appsettings.json">
|
<None Update="appsettings.json">
|
||||||
<CopyToOutputDirectory>always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>>always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
44
FarmMapsBlight/Models/Fungicide.cs
Normal file
44
FarmMapsBlight/Models/Fungicide.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace FarmMapsBlight.Models {
|
||||||
|
public class Fungicide {
|
||||||
|
public string code { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string ctgbregistrationnumber { get; set; }
|
||||||
|
public string ai1 { get; set; }
|
||||||
|
public string ai2 { get; set; }
|
||||||
|
public string ai3 { get; set; }
|
||||||
|
public double contentai1 { get; set; }
|
||||||
|
public double contentai2 { get; set; }
|
||||||
|
public double contentai3 { get; set; }
|
||||||
|
public string contentunit { get; set; }
|
||||||
|
public string aidescription { get; set; }
|
||||||
|
public int protectioncategory { get; set; }
|
||||||
|
public double preventivescore { get; set; }
|
||||||
|
public double curativescore { get; set; }
|
||||||
|
public string applicationrateunit { get; set; }
|
||||||
|
public double recommendeddose { get; set; }
|
||||||
|
public double newgrowth { get; set; }
|
||||||
|
public double tuberprotection { get; set; }
|
||||||
|
public double dryingtimemin { get; set; }
|
||||||
|
public double dryingtimemax { get; set; }
|
||||||
|
public double rainfastness { get; set; }
|
||||||
|
public double mindose { get; set; }
|
||||||
|
public double maxdose { get; set; }
|
||||||
|
public int? maxapplications { get; set; }
|
||||||
|
public bool vracompatible { get; set; }
|
||||||
|
public double eradicativescore { get; set; }
|
||||||
|
public bool emergence { get; set; }
|
||||||
|
public bool fastgrowth { get; set; }
|
||||||
|
public bool earlytubersetting { get; set; }
|
||||||
|
public bool tuberfilling { get; set; }
|
||||||
|
public int? safedays { get; set; }
|
||||||
|
public double takeback {
|
||||||
|
get {
|
||||||
|
return curativescore * 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,9 @@ namespace FarmMapsBlight.Models
|
|||||||
{
|
{
|
||||||
public class Spray
|
public class Spray
|
||||||
{
|
{
|
||||||
public DateTime SprayTime { get; set; }
|
public DateTime sprayTime { get; set; }
|
||||||
public string fungicideCode { get; set; }
|
public string fungicideCode { get; set; }
|
||||||
|
public Fungicide fungicide { get; set; }
|
||||||
public double dose { get; set; }
|
public double dose { get; set; }
|
||||||
public bool isVRA { get; set; }
|
public bool isVRA { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ namespace FarmmapsApi.Services
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//the taskmap is a child of the input tiff
|
//the taskmap is a child of the input tiff *** Update feb 2021: it is a child of the cropfield.
|
||||||
var itemName = "Taskmap";
|
var itemName = "Taskmap";
|
||||||
var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
|
var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
|
||||||
SHAPE_PROCESSED_ITEMTYPE, itemName);
|
SHAPE_PROCESSED_ITEMTYPE, itemName);
|
||||||
@ -177,8 +177,6 @@ namespace FarmmapsApi.Services
|
|||||||
await PollTask(TimeSpan.FromSeconds(3), async source => {
|
await PollTask(TimeSpan.FromSeconds(3), async source => {
|
||||||
_logger.LogInformation($"Trying to get {containsName} data");
|
_logger.LogInformation($"Trying to get {containsName} data");
|
||||||
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType);
|
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType);
|
||||||
|
|
||||||
|
|
||||||
Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower()));
|
Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower()));
|
||||||
dataItem = uploadedFilesChildren.FirstOrDefault(func);
|
dataItem = uploadedFilesChildren.FirstOrDefault(func);
|
||||||
if (dataItem != null || tries == maxTries) {
|
if (dataItem != null || tries == maxTries) {
|
||||||
|
@ -10,7 +10,7 @@ namespace FarmmapsZonering.Models
|
|||||||
public string Formula { get; set; }
|
public string Formula { get; set; }
|
||||||
public string OutputFileName { get; set; }
|
public string OutputFileName { get; set; }
|
||||||
public string CropFieldName { get; set; }
|
public string CropFieldName { get; set; }
|
||||||
public string LayerName { get; set; }
|
public string CalculatedLayerName { get; set; }
|
||||||
public string CalculatedQuantity { get; set; }
|
public string CalculatedQuantity { get; set; }
|
||||||
public string CalculatedUnit { get; set; }
|
public string CalculatedUnit { get; set; }
|
||||||
public bool CreateNewCropfield { get; set; }
|
public bool CreateNewCropfield { get; set; }
|
||||||
|
@ -103,10 +103,6 @@ namespace FarmmapsZonering
|
|||||||
_settings.CropfieldItemCode = cropfieldItem.Code;
|
_settings.CropfieldItemCode = cropfieldItem.Code;
|
||||||
SaveSettings(settingsfile);
|
SaveSettings(settingsfile);
|
||||||
|
|
||||||
//cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, "Cropfield VRA Zonering", 2020,
|
|
||||||
// @"{ ""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(settingsfile);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -157,18 +153,14 @@ namespace FarmmapsZonering
|
|||||||
//var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
|
//var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
|
||||||
// Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
|
// Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
|
||||||
|
|
||||||
//if (inputTwoItem == null)
|
//if (inputTwoItem == null) {
|
||||||
//{
|
|
||||||
// _logger.LogError("Could not find item for uploaded data");
|
// _logger.LogError("Could not find item for uploaded data");
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//var inputOneItem = input.InputItemOne;
|
|
||||||
//var inputTwoItem = input.InputItemTwo;
|
|
||||||
|
|
||||||
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, input.Formula, new Output()
|
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, input.Formula, new Output()
|
||||||
{
|
{
|
||||||
Name = input.LayerName,
|
Name = input.CalculatedLayerName,
|
||||||
Quantity = input.CalculatedQuantity,
|
Quantity = input.CalculatedQuantity,
|
||||||
Unit = input.CalculatedUnit,
|
Unit = input.CalculatedUnit,
|
||||||
|
|
||||||
@ -177,22 +169,20 @@ namespace FarmmapsZonering
|
|||||||
{
|
{
|
||||||
ItemCode = inputOneItem.Code,
|
ItemCode = inputOneItem.Code,
|
||||||
LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
|
LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
|
||||||
}
|
//},
|
||||||
//,
|
|
||||||
//new InputParameter()
|
//new InputParameter()
|
||||||
//{
|
//{
|
||||||
// //ItemCode = inputOneItem.Code,
|
// ItemCode = inputTwoItem.Code,
|
||||||
// //LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
|
// LayerName = inputTwoItem.Data["layers"][0]["name"].ToString()
|
||||||
//}
|
});
|
||||||
);;
|
|
||||||
|
|
||||||
_logger.LogInformation("Downloading output");
|
_logger.LogInformation("Downloading output");
|
||||||
|
_logger.LogInformation($"outputitem: {outputItem} with code {outputItem.Code} and date {outputItem.DataDate}");
|
||||||
|
|
||||||
|
|
||||||
await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
|
await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
|
||||||
|
|
||||||
Path.Combine(DownloadFolder, $"{input.OutputFileName}.zip"));
|
Path.Combine(DownloadFolder, $"{input.OutputFileName}.zoning.zip"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions to save previously created cropfields
|
// Functions to save previously created cropfields
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
// [ 4.9667833, 52.8030414 ],
|
// [ 4.9667833, 52.8030414 ],
|
||||||
// [ 4.9593709, 52.8014339 ]
|
// [ 4.9593709, 52.8014339 ]
|
||||||
// ]
|
// ]
|
||||||
|
|
||||||
// ]
|
// ]
|
||||||
// }
|
// }
|
||||||
//,
|
//,
|
||||||
@ -65,7 +64,6 @@
|
|||||||
// [ 5.66886041703652044, 52.52929999060298627 ]
|
// [ 5.66886041703652044, 52.52929999060298627 ]
|
||||||
// ]
|
// ]
|
||||||
// ]
|
// ]
|
||||||
|
|
||||||
// }
|
// }
|
||||||
//},
|
//},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user