UserInput #12

Merged
mark merged 4 commits from UserInput into master 2022-02-28 13:28:24 +00:00
7 changed files with 51 additions and 27 deletions
Showing only changes of commit b6764c5e1a - Show all commits

View File

@ -12,6 +12,7 @@ namespace FarmmapsApiSamples
public const string SHAPE_ITEMTYPE = "vnd.farmmaps.itemtype.shape";
public const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson";
public const string BLIGHT_ITEMTYPE = "vnd.farmmaps.itemtype.blight";
public const string CROPREC_ITEMTYPE = "vnd.farmmaps.itemtype.crprec.operation";
public const string VRANBS_TASK = "vnd.farmmaps.task.vranbs";
public const string VRAHERBICIDE_TASK = "vnd.farmmaps.task.vraherbicide";

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);
mark marked this conversation as resolved
Review

Dit doet niks.
Als je 500ms wilt wachten doe je het volgende 'await Task.Delay(500);'

Dit doet niks. Als je 500ms wilt wachten doe je het volgende 'await Task.Delay(500);'
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");
@ -221,9 +246,6 @@ namespace FarmmapsDataDownload
// Select a particular satellite item from satelliteTask
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; }
}
}

View File

@ -188,7 +188,6 @@ namespace FarmmapsNbs {
////End shape to geotiff transformation
}
_logger.LogInformation($"Calculating targetN with targetYield: {input.TargetYield}");
var targetNItem = await _nitrogenService.CreateTargetNItem(cropfieldItem);
var targetNData = await _nitrogenService.CalculateTargetN(cropfieldItem, targetNItem, plantingDate,

View File

@ -1,11 +1,11 @@
[
{
"UseCreatedCropfield": false,
"UseCreatedCropfield": true,
"file": "Scan1_20190605_sample.json",
"inputVariable": "irmi",
"inputLayerName": "irmi",
"outputFileName": "vranbs_sample",
"fieldName": "sampleJson_irmi",
"fieldName": "sampleJson_irmi-usertest",
"storeSatelliteStatistics": true,
"plantingDate": "2019-04-18",
"measurementDate": "2019-06-05",

View File

@ -2,11 +2,11 @@
//There are three farmmaps environments, uncomment the environemnt you want to use with this sample client
//test environment
// "Authority": "https://accounts.test.farmmaps.eu/",
// "Endpoint": "https://test.farmmaps.eu/",
// "BasePath": "api/v1",
// "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration",
// "GrantClientId": "farmmapstesteu",
"Authority": "https://accounts.test.farmmaps.eu/",
"Endpoint": "https://test.farmmaps.eu/",
"BasePath": "api/v1",
"DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration",
"GrantClientId": "farmmapstesteu",
////acceptance environment
//"Authority": "https://accounts.acc.farmmaps.eu/",
@ -15,12 +15,12 @@
//"DiscoveryEndpointUrl": "https://accounts.acc.farmmaps.eu/.well-known/openid-configuration",
//"GrantClientId": "farmmapsacceu",
//production environment
"authority": "https://accounts.farmmaps.eu/",
"endpoint": "https://farmmaps.eu/",
"basepath": "api/v1",
"discoveryendpointurl": "https://accounts.farmmaps.eu/.well-known/openid-configuration",
"GrantClientId": "farmmaps",
////production environment
//"authority": "https://accounts.farmmaps.eu/",
//"endpoint": "https://farmmaps.eu/",
//"basepath": "api/v1",
//"discoveryendpointurl": "https://accounts.farmmaps.eu/.well-known/openid-configuration",
//"GrantClientId": "farmmaps",
//overige info
"RedirectUri": "http://example.nl/api",