forked from FarmMaps/FarmMapsApiClient
update Blight
This commit is contained in:
Binary file not shown.
@@ -23,5 +23,9 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FarmmapsApi\FarmmapsApi.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Data" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
@@ -48,18 +48,11 @@ namespace FarmmapsZonering.Services
|
||||
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(cropfieldItem.Code);
|
||||
//int last = uploadedFilesChildren.Count - 1;
|
||||
//var applianceMapItem = uploadedFilesChildren[last];
|
||||
|
||||
|
||||
var itemName = output.Name;
|
||||
//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()));
|
||||
GEOTIFF_PROCESSED_ITEMTYPE, output.Name,
|
||||
i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) &&
|
||||
i.Name.ToLower().Contains(output.Name.ToLower()));
|
||||
|
||||
if (applianceMapItem == null)
|
||||
{
|
||||
|
@@ -91,7 +91,7 @@ namespace FarmmapsZonering
|
||||
}
|
||||
|
||||
Item cropfieldItem;
|
||||
if (string.IsNullOrEmpty(_settings.CropfieldItemCode) || input.CreateNewCropfield == true)
|
||||
if (input.CreateNewCropfield == true) // || string.IsNullOrEmpty(_settings.CropfieldItemCode) ## CHECK IT!!
|
||||
{
|
||||
_logger.LogInformation("Creating cropfield");
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace FarmmapsZonering
|
||||
_settings.CropfieldName = cropfieldItem.Name;
|
||||
_settings.CropfieldItemCode = cropfieldItem.Code;
|
||||
SaveSettings(settingsfile);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,19 +143,20 @@ namespace FarmmapsZonering
|
||||
var inputOneItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
|
||||
Path.Combine("Data", $"{input.InputItemOne}"), Path.GetFileNameWithoutExtension($"{input.InputItemOne}"));
|
||||
|
||||
if (inputOneItem == null) {
|
||||
if (inputOneItem == null)
|
||||
{
|
||||
_logger.LogError("Could not find item for uploaded data");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
|
||||
Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
|
||||
|
||||
if (inputTwoItem == null) {
|
||||
_logger.LogError("Could not find item for uploaded data");
|
||||
return;
|
||||
}
|
||||
//var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
|
||||
// Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
|
||||
|
||||
//if (inputTwoItem == null) {
|
||||
// _logger.LogError("Could not find item for uploaded data");
|
||||
// return;
|
||||
//}
|
||||
|
||||
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, input.Formula, new Output()
|
||||
{
|
||||
@@ -167,16 +169,15 @@ namespace FarmmapsZonering
|
||||
{
|
||||
ItemCode = inputOneItem.Code,
|
||||
LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
|
||||
},
|
||||
new InputParameter()
|
||||
{
|
||||
ItemCode = inputTwoItem.Code,
|
||||
LayerName = inputTwoItem.Data["layers"][0]["name"].ToString()
|
||||
//},
|
||||
//new InputParameter()
|
||||
//{
|
||||
// ItemCode = inputTwoItem.Code,
|
||||
// LayerName = inputTwoItem.Data["layers"][0]["name"].ToString()
|
||||
});
|
||||
|
||||
_logger.LogInformation("Downloading output");
|
||||
_logger.LogInformation($"outputitem: {outputItem} with code {outputItem.Code} and date {outputItem.DataDate}");
|
||||
//_logger.LogInformation($"Data: {outputItem.Data}");
|
||||
|
||||
await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
|
||||
|
||||
|
@@ -1,102 +1,99 @@
|
||||
//[
|
||||
|
||||
//Formule kan meerdere inputs aan
|
||||
// Met blokhaken en een nummer specificeer je een input:
|
||||
//[0], [10]. etc...
|
||||
// Aan de hand van de volgorde van input wordt momenteel bepaald welk nummer bij welk input hoort.
|
||||
//[0] is dus de eerst tiff opgegeven.Als het goed is maakt het nummer nu niks uit, dus als er 2 inputs zijn en in de formule staan[0] en[10] dan zal die nog steeds werken.
|
||||
//De volgorde van de tiff kun je verslepen, bij de formule inputs kun je de input van het ene[0] slot naar het andere slepen[10]
|
||||
//Functies: abs, min en max
|
||||
//Constanten: pi en e
|
||||
|
||||
//if ([0] -[1])/ ([0] +[1]) < 0 then 0
|
||||
//else if ([0] -[1])/ ([0] +[1]) > 1 then 1
|
||||
//else ([0] -[1]) / ([0] +[1])
|
||||
|
||||
//{
|
||||
// "InputItemOne": "20201106_Sentinel2_L2A_B04.tiff",
|
||||
// "InputItemTwo": "20201106_Sentinel2_L2A_B08.tiff",
|
||||
// "Formula": "([1]-[0])/([1]+[0])",
|
||||
// "CreatedLayerName": "Biomassa",
|
||||
// "CalculatedQuantity": "NDVI",
|
||||
// "CalculatedUnit": "ndviValue",
|
||||
|
||||
// "OutputFileName": "FullField_NDVI",
|
||||
// "CropFieldName": "FullField",
|
||||
// "CreateNewCropfield": false,
|
||||
// "CropYear": 2020,
|
||||
// "geometryJson": {
|
||||
// "type": "Polygon",
|
||||
// "coordinates": [
|
||||
|
||||
// [
|
||||
// [ 4.9593709, 52.8014339 ],
|
||||
// [ 4.9675488, 52.7943149 ],
|
||||
// [ 4.9735195, 52.7968665 ],
|
||||
// [ 4.9667833, 52.8030414 ],
|
||||
// [ 4.9593709, 52.8014339 ]
|
||||
// ]
|
||||
|
||||
// ]
|
||||
// },
|
||||
[
|
||||
|
||||
//{
|
||||
// "InputItemOne": "20210127_L2A_B08_(Raw).tiff",
|
||||
// "InputItemTwo": "20210127_L2A_B04_(Raw).tiff",
|
||||
// "Formula": "([0]-[1])/([0]+[1])+0.3",
|
||||
// "CalculatedLayerName": "Biomassa",
|
||||
// "CalculatedQuantity": "NDVI",
|
||||
// "CalculatedUnit": "wdviValue",
|
||||
// "OutputFileName": "20210212_NDVI-test",
|
||||
// "CropFieldName": "Mahindra-Hapreet_Singh-2",
|
||||
// "UseShadow": false,
|
||||
// "GetWatBal": false,
|
||||
// "GetVanDerSat": false,
|
||||
// "storeVanDerSatStatistics": false,
|
||||
// "CropYear": 2020,
|
||||
// "geometryJson": {
|
||||
// "type": "Polygon",
|
||||
// "coordinates": [
|
||||
// [
|
||||
// [ 31.63887936537028, 75.92907261717566 ],
|
||||
// [ 31.63895684173582, 75.93143281072912 ],
|
||||
// [ 31.63940906549488, 75.93135348937818 ],
|
||||
// [ 31.63931497834855, 75.9290907801773 ],
|
||||
// [ 31.63887936537028, 75.92907261717566 ]
|
||||
// ]
|
||||
// ]
|
||||
//Formule kan meerdere inputs aan
|
||||
// Met blokhaken en een nummer specificeer je een input:
|
||||
//[0], [10]. etc...
|
||||
// Aan de hand van de volgorde van input wordt momenteel bepaald welk nummer bij welk input hoort.
|
||||
//[0] is dus de eerst tiff opgegeven.Als het goed is maakt het nummer nu niks uit, dus als er 2 inputs zijn en in de formule staan[0] en[10] dan zal die nog steeds werken.
|
||||
//De volgorde van de tiff kun je verslepen, bij de formule inputs kun je de input van het ene[0] slot naar het andere slepen[10]
|
||||
//Functies: abs, min en max
|
||||
//Constanten: pi en e
|
||||
|
||||
// }
|
||||
//}
|
||||
//if ([0] -[1])/ ([0] +[1]) < 0 then 0
|
||||
//else if ([0] -[1])/ ([0] +[1]) > 1 then 1
|
||||
//else ([0] -[1]) / ([0] +[1])
|
||||
|
||||
{
|
||||
"InputItemOne": "2020-04-22_sentinel-2_l2a_b08.tiff",
|
||||
"InputItemTwo": "2020-04-22_sentinel-2_l2a_b04.tiff",
|
||||
"Formula": "([0]-[1])/([0]+[1])",
|
||||
"CalculatedLayerName": "Biomassa",
|
||||
"CalculatedQuantity": "NDVI",
|
||||
"CalculatedUnit": "ndviValue",
|
||||
"OutputFileName": "20210212_NDVI-test_FS",
|
||||
"CropFieldName": "MestSiloAduard",
|
||||
"UseShadow": false,
|
||||
"GetWatBal": false,
|
||||
"GetVanDerSat": false,
|
||||
"storeVanDerSatStatistics": false,
|
||||
"CropYear": 2020,
|
||||
"geometryJson": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[ 6.48274677, 53.25861525 ],
|
||||
[ 6.48740108, 53.25799841 ],
|
||||
[ 6.48756130, 53.25934424 ],
|
||||
[ 6.48285892, 53.25953650 ],
|
||||
[ 6.48274677, 53.25861525 ]
|
||||
]
|
||||
]
|
||||
//{
|
||||
// "InputItemOne": "20201106_Sentinel2_L2A_B04.tiff",
|
||||
// "InputItemTwo": "20201106_Sentinel2_L2A_B08.tiff",
|
||||
// "Formula": "([1]-[0])/([1]+[0])",
|
||||
// "CreatedLayerName": "Biomassa",
|
||||
// "CalculatedQuantity": "NDVI",
|
||||
// "CalculatedUnit": "ndviValue",
|
||||
|
||||
// "OutputFileName": "FullField_NDVI",
|
||||
// "CropFieldName": "FullField",
|
||||
// "CreateNewCropfield": false,
|
||||
// "CropYear": 2020,
|
||||
// "geometryJson": {
|
||||
// "type": "Polygon",
|
||||
// "coordinates": [
|
||||
|
||||
// [
|
||||
// [ 4.9593709, 52.8014339 ],
|
||||
// [ 4.9675488, 52.7943149 ],
|
||||
// [ 4.9735195, 52.7968665 ],
|
||||
// [ 4.9667833, 52.8030414 ],
|
||||
// [ 4.9593709, 52.8014339 ]
|
||||
// ]
|
||||
// ]
|
||||
// }
|
||||
//,
|
||||
//{
|
||||
// "InputItemOne": "data_9001.tif",
|
||||
// "InputItemTwo": "data_times_two_4326.tiff",
|
||||
// "Formula": "if [0] >= 1.28 then [1] else 0",
|
||||
// "CreatedLayerName": "Biomassa",
|
||||
// "CalculatedQuantity": "NDVI",
|
||||
// "CalculatedUnit": "ndviValue",
|
||||
// "OutputFileName": "Zoning",
|
||||
// "CropFieldName": "Data_whole",
|
||||
// "UseShadow": false,
|
||||
// "GetWatBal": false,
|
||||
// "GetVanDerSat": false,
|
||||
// "storeVanDerSatStatistics": false,
|
||||
// "CropYear": 2020,
|
||||
// "geometryJson": {
|
||||
// "type": "Polygon",
|
||||
// "coordinates": [
|
||||
// [
|
||||
// [ 5.66886041703652044, 52.52929999060298627 ],
|
||||
// [ 5.6716230923214912, 52.52946316399909676 ],
|
||||
// [ 5.67185376229668581, 52.5280565894154563 ],
|
||||
// [ 5.66903207841337231, 52.52790646510525363 ],
|
||||
// [ 5.66886041703652044, 52.52929999060298627 ]
|
||||
// ]
|
||||
// ]
|
||||
// }
|
||||
//},
|
||||
{
|
||||
"InputItemOne": "VRApoten_appliancemap_20210215_vraPoten_SampleData_CovertArea.tif",
|
||||
//"InputItemTwo": "",
|
||||
"Formula": "((100/[0])/0.75)",
|
||||
"LayerName": "CountPerAreaConversion",
|
||||
"CalculatedQuantity": "CountPerArea",
|
||||
"CalculatedUnit": "#/m2",
|
||||
"OutputFileName": "CountPerAreaConversionOutput",
|
||||
"CropFieldName": "ZoningCpA",
|
||||
"CreateNewCropfield": true,
|
||||
"UseShadow": false,
|
||||
"GetWatBal": false,
|
||||
"GetVanDerSat": false,
|
||||
"storeVanDerSatStatistics": false,
|
||||
"CropYear": 2020,
|
||||
"geometryJson": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[ 5.66886041703652044, 52.52929999060298627 ],
|
||||
[ 5.6716230923214912, 52.52946316399909676 ],
|
||||
[ 5.67185376229668581, 52.5280565894154563 ],
|
||||
[ 5.66903207841337231, 52.52790646510525363 ],
|
||||
[ 5.66886041703652044, 52.52929999060298627 ]
|
||||
]
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
|
Reference in New Issue
Block a user