forked from FarmMaps/FarmMapsApiClient
added download of all crop recordings of 1 field - using a manual croprecording itemcode
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user