Select satellite image and assign datalayer
This commit is contained in:
@@ -299,7 +299,7 @@ namespace FarmmapsApi.Services
|
||||
}
|
||||
|
||||
|
||||
public async Task<Item> FindSatelliteItems(Item cropfieldItem, string satelliteTaskCode)
|
||||
public async Task<Item> FindSatelliteItem(Item cropfieldItem, string satelliteTaskCode)
|
||||
{
|
||||
|
||||
var taskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, satelliteTaskCode);
|
||||
@@ -311,25 +311,40 @@ namespace FarmmapsApi.Services
|
||||
taskStatus.Finished >= item.Created &&
|
||||
taskStatus.Finished <= item.Created.Value.AddHours(1));
|
||||
|
||||
|
||||
if (temporalItem == null)
|
||||
{
|
||||
_logger.LogError("Temporal item not found");
|
||||
|
||||
|
||||
}
|
||||
|
||||
var satelliteTiffs = await _farmmapsApiService.GetItemChildrenAsync(temporalItem.Code);
|
||||
var firstSatelliteItem = satelliteTiffs.FirstOrDefault();
|
||||
|
||||
if (firstSatelliteItem == null)
|
||||
_logger.LogInformation("Available satellite images:");
|
||||
var count = 0;
|
||||
TimeSpan.FromSeconds(0.5);
|
||||
foreach (var item in satelliteTiffs)
|
||||
{
|
||||
|
||||
Console.WriteLine($"Satellite image #{count}: {item.DataDate}");
|
||||
count++;
|
||||
}
|
||||
_logger.LogInformation("Enter satellite image number for NBS application");
|
||||
int elment = Int32.Parse(Console.ReadLine());
|
||||
|
||||
var selectedSatelliteItem = satelliteTiffs[elment];
|
||||
|
||||
if (selectedSatelliteItem == null)
|
||||
{
|
||||
_logger.LogError("Satellite item not found");
|
||||
|
||||
|
||||
}
|
||||
|
||||
return firstSatelliteItem;
|
||||
return selectedSatelliteItem;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user