added download of all crop recordings of 1 field - using a manual croprecording itemcode

This commit is contained in:
2022-02-24 16:32:51 +01:00
committed by Gitea
parent 0767b3fff8
commit 44cde0fe15
7 changed files with 51 additions and 27 deletions

View File

@@ -112,9 +112,34 @@ namespace FarmmapsDataDownload
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
}
//Get croprecordings
if (input.GetCropRecordings)
{
var crprecItem = input.CrprecItem;
//Item cropfieldItem = ;
_logger.LogInformation($"Trying to get crop recordings of croprecording: {crprecItem}");
var cropRec = await _farmmapsApiService.GetItemChildrenAsync(crprecItem, CROPREC_ITEMTYPE);
if (cropRec == null)
{
_logger.LogError("Something went wrong while obtaining the croprecordings");
return;
}
var cropRecPath = Path.Combine(downloadFolder, $"croprecordings_{crprecItem}.json");
_logger.LogInformation($"Found {cropRec.Count} crop recordings");
var count = 0;
TimeSpan.FromSeconds(0.5);
foreach (var item in cropRec)
{
Console.WriteLine($"Crop recording #{count}: {item.Name}");
File.AppendAllText(cropRecPath, item.Data +Environment.NewLine);
count++;
}
_logger.LogInformation($"Downloaded file {cropRecPath}");
}
// Get shadow data
if (input.GetShadowData)
{
_logger.LogInformation("Calculate shadow map for field");
@@ -220,10 +245,7 @@ namespace FarmmapsDataDownload
}
// Select a particular satellite item from satelliteTask
Item vanDerSatItem = await _generalService.FindVanDerSatItem(cropfieldItem, _settings.VanDerSatTaskCode, fieldName, input.StoreVanDerSatStatistics);
Item vanDerSatItem = await _generalService.FindVanDerSatItem(cropfieldItem, _settings.VanDerSatTaskCode, fieldName, input.StoreVanDerSatStatistics);
}

View File

@@ -1,14 +1,16 @@
[
{
"UseCreatedCropfield": true,
"outputFileName": "testSatData2",
"fieldName": "test_satData2",
"DownloadFolder": "C:\\workdir\\groenmonitor\\", //"C:\\workdir\\groenmonitor\\", // "Downloads", -> if you just put "Downloads" the program will download to somewhere in ..\FarmMapsApiClient_WURtest\FarmmapsDataDownload\bin\Debug\netcoreapp3.1\Downloads\
"outputFileName": "TestData",
"fieldName": "TestField",
"DownloadFolder": "Downloads", //"C:\\workdir\\groenmonitor\\", // "Downloads", -> if you just put "Downloads" the program will download to somewhere in ..\FarmMapsApiClient_WURtest\FarmmapsDataDownload\bin\Debug\netcoreapp3.1\Downloads\
"GetCropRecordings": true,
"CrprecItem": "...", //item code of de crop recording parrent - can be found by opening the crop recording page of a field.
"GetShadowData": false,
"GetSatelliteData": true,
"GetSatelliteData": false,
"SatelliteBand": "wdvi", // "natural", "ndvi" or "wdvi"
"StoreSatelliteStatisticsSingleImage": true,
"StoreSatelliteStatisticsCropYear": true,
"StoreSatelliteStatisticsSingleImage": false,
"StoreSatelliteStatisticsCropYear": false,
"GetVanDerSatData": false,
"StoreVanDerSatStatistics": false,
"CropYear": 2020,

View File

@@ -21,8 +21,8 @@ namespace FarmmapsDataDownload.Models
public bool StoreSatelliteStatisticsCropYear { get; set; }
public bool StoreVanDerSatStatistics { get; set; }
public bool GetShadowData { get; set; }
public bool GetCropRecordings { get; set; }
public string CrprecItem { get; set; }
}
}