Update appsettings, included the three environments test, acceptance and production. + update the NBS sample code to the newest flow (backwards compatible #10

Merged
mark merged 1 commits from NBS_update into master 2022-02-11 12:31:21 +00:00
5 changed files with 8973 additions and 229 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,10 +12,8 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using static FarmmapsApiSamples.Constants; using static FarmmapsApiSamples.Constants;
namespace FarmmapsNbs namespace FarmmapsNbs {
{ public class NbsApplication : IApplication {
public class NbsApplication : IApplication
{
private const string DownloadFolder = "Downloads"; private const string DownloadFolder = "Downloads";
private const string SettingsFile = "settings.json"; private const string SettingsFile = "settings.json";
@ -27,16 +25,14 @@ namespace FarmmapsNbs
private Settings _settings; private Settings _settings;
public NbsApplication(ILogger<NbsApplication> logger, FarmmapsApiService farmmapsApiService, public NbsApplication(ILogger<NbsApplication> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService, NitrogenService nitrogenService) GeneralService generalService, NitrogenService nitrogenService) {
{
_logger = logger; _logger = logger;
_farmmapsApiService = farmmapsApiService; _farmmapsApiService = farmmapsApiService;
_generalService = generalService; _generalService = generalService;
_nitrogenService = nitrogenService; _nitrogenService = nitrogenService;
} }
public async Task RunAsync() public async Task RunAsync() {
{
var nitrogenInputJson = File.ReadAllText("NitrogenInput.json"); var nitrogenInputJson = File.ReadAllText("NitrogenInput.json");
List<NitrogenInput> nitrogenInputs = JsonConvert.DeserializeObject<List<NitrogenInput>>(nitrogenInputJson); List<NitrogenInput> nitrogenInputs = JsonConvert.DeserializeObject<List<NitrogenInput>>(nitrogenInputJson);
@ -47,21 +43,16 @@ namespace FarmmapsNbs
await _farmmapsApiService.GetCurrentUserCodeAsync(); await _farmmapsApiService.GetCurrentUserCodeAsync();
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync(); var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
foreach (var input in nitrogenInputs) foreach (var input in nitrogenInputs) {
{ try {
try
{
await Process(roots, input); await Process(roots, input);
} } catch (Exception ex) {
catch (Exception ex)
{
_logger.LogError(ex.Message); _logger.LogError(ex.Message);
} }
} }
} }
private async Task Process(List<UserRoot> roots, NitrogenInput input) private async Task Process(List<UserRoot> roots, NitrogenInput input) {
{
// !!specify if you are using an already created cropfield: // !!specify if you are using an already created cropfield:
bool useCreatedCropfield = input.UseCreatedCropfield; bool useCreatedCropfield = input.UseCreatedCropfield;
@ -74,45 +65,39 @@ namespace FarmmapsNbs
LoadSettings(settingsfile); LoadSettings(settingsfile);
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded"); var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
if (uploadedRoot == null) if (uploadedRoot == null) {
{
_logger.LogError("Could not find a needed root item"); _logger.LogError("Could not find a needed root item");
return; return;
} }
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive"); var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive");
if (myDriveRoot == null) if (myDriveRoot == null) {
{
_logger.LogError("Could not find a needed root item"); _logger.LogError("Could not find a needed root item");
return; return;
} }
// Use already created cropfield or create new one // Use already created cropfield or create new one
Item cropfieldItem; Item cropfieldItem;
if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.CropfieldItemCode)) if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.CropfieldItemCode)) {
{
_logger.LogInformation("Creating cropfield"); _logger.LogInformation("Creating cropfield");
cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code, cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code,
$"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None)); $"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None));
_settings.CropfieldItemCode = cropfieldItem.Code; _settings.CropfieldItemCode = cropfieldItem.Code;
SaveSettings(settingsfile); SaveSettings(settingsfile);
} } else {
else
{
_logger.LogInformation("Cropfield already exists, trying to get it"); _logger.LogInformation("Cropfield already exists, trying to get it");
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
} }
var inputItem = (Item)null;
var geotiffItem = (Item)null; var geotiffItem = (Item)null;
// If no input file is specified, use most recent satellite image // If no input file is specified, use most recent satellite image
if (string.IsNullOrEmpty(input.File)) if (string.IsNullOrEmpty(input.File)) {
{
_logger.LogInformation("No specific data given, retrieving most recent satellite image"); _logger.LogInformation("No specific data given, retrieving most recent satellite image");
// check if satellite task not yet done, do here and save taskcode // check if satellite task not yet done, do here and save taskcode
if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.SatelliteTaskCode)) if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.SatelliteTaskCode)) {
{
var satelliteTaskCode = await _generalService.RunSatelliteTask(cropfieldItem); var satelliteTaskCode = await _generalService.RunSatelliteTask(cropfieldItem);
_settings.SatelliteTaskCode = satelliteTaskCode; _settings.SatelliteTaskCode = satelliteTaskCode;
SaveSettings(settingsfile); SaveSettings(settingsfile);
@ -120,96 +105,87 @@ namespace FarmmapsNbs
// Select a particular satellite item from satelliteTask // Select a particular satellite item from satelliteTask
Item satalliteItem = await _generalService.FindSatelliteItem(cropfieldItem, _settings.SatelliteTaskCode); Item satelliteItem = await _generalService.FindSatelliteItem(cropfieldItem, _settings.SatelliteTaskCode);
var satelliteBand = satalliteItem.Data["layers"][0]["name"]; var satelliteBand = satelliteItem.Data["layers"][0]["name"];
var satelliteStatistics = satalliteItem.Data["layers"][0]["renderer"]["band"]["statistics"]; var satelliteStatistics = satelliteItem.Data["layers"][0]["renderer"]["band"]["statistics"];
Console.WriteLine($"Satellite image date: {satalliteItem.DataDate}"); Console.WriteLine($"Satellite image date: {satelliteItem.DataDate}");
//Console.WriteLine($"Satellite image statistics for band {satelliteBand}: {satelliteStatistics}"); //Console.WriteLine($"Satellite image statistics for band {satelliteBand}: {satelliteStatistics}");
//Store data to csv //Store data to csv
if (StoreStatistics == true) if (StoreStatistics == true) {
{
var SatelliteStatsFile = $"{DownloadFolder}/SatelliteDataStatistics_{FieldName}_{satalliteItem.DataDate.Value:yyyy-MM-dd}.csv"; var SatelliteStatsFile = $"{DownloadFolder}/SatelliteDataStatistics_{FieldName}_{satelliteItem.DataDate.Value:yyyy-MM-dd}.csv";
using var w = new StreamWriter(SatelliteStatsFile); using var w = new StreamWriter(SatelliteStatsFile);
{ {
foreach (var item in satelliteStatistics) foreach (var item in satelliteStatistics) {
{
var line = string.Format("{0}", item); var line = string.Format("{0}", item);
w.WriteLine(line); w.WriteLine(line);
w.Flush(); w.Flush();
} }
} }
} }
// must be wdvi[1] // must be wdvi[1]
var inputType = (satalliteItem.Data["layers"] as JArray)?[1]["name"].ToString(); var inputType = (satelliteItem.Data["layers"] as JArray)?[1]["name"].ToString();
if (string.IsNullOrEmpty(inputType)) if (string.IsNullOrEmpty(inputType)) {
{
_logger.LogError("Could not get the input type name from the satellite item"); _logger.LogError("Could not get the input type name from the satellite item");
return; return;
} }
// download the geotiff // download the geotiff
var SatelliteImageDate = (DateTime)satalliteItem.DataDate; var SatelliteImageDate = (DateTime)satelliteItem.DataDate;
var SatelliteDate = SatelliteImageDate.ToString("yyyyMMdd"); var SatelliteDate = SatelliteImageDate.ToString("yyyyMMdd");
_logger.LogInformation("Downloading geotiff file"); _logger.LogInformation("Downloading geotiff file");
await _farmmapsApiService.DownloadItemAsync(satalliteItem.Code, await _farmmapsApiService.DownloadItemAsync(satelliteItem.Code,
Path.Combine(DownloadFolder, $"nbs_inputSatelliteGeotiff_{input.OutputFileName}_{inputType}_{SatelliteDate}.zip")); Path.Combine(DownloadFolder, $"nbs_inputSatelliteGeotiff_{input.OutputFileName}_{inputType}_{SatelliteDate}.zip"));
// overwrite measurement date by date of satellite item // overwrite measurement date by date of satellite item
measurementDate = satalliteItem.DataDate.Value; measurementDate = satelliteItem.DataDate.Value;
inputItem = satelliteItem;
geotiffItem = satalliteItem;
} }
// (geo)tiff input: // (geo)tiff input:
else if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) else if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) {
{
_logger.LogInformation("input = tiff data"); _logger.LogInformation("input = tiff data");
var dataPath = Path.Combine("Data", input.File); var dataPath = Path.Combine("Data", input.File);
geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath, inputItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath,
Path.GetFileNameWithoutExtension(input.File)); Path.GetFileNameWithoutExtension(input.File));
if (geotiffItem == null) if (geotiffItem == null) {
{
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
} }
// json/shape input // json/shape input
else else {
{
var isGeoJson = input.File.Contains("json"); var isGeoJson = input.File.Contains("json");
var dataPath = Path.Combine("Data", input.File); var dataPath = Path.Combine("Data", input.File);
var shapeItem = isGeoJson ? var shapeItem = isGeoJson ?
await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None)) : await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None)) :
await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None)); await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None));
if (shapeItem == null) if (shapeItem == null) {
{
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
inputItem = shapeItem;
////convert shape to geotiff, not necessary anymore. However can still be done
//_logger.LogInformation($"Converting shape to geotiff");
//geotiffItem = await _generalService.ShapeToGeotiff(shapeItem, 1, input.InputLayerName);
//if (geotiffItem == null)
//{
// _logger.LogError("Something went wrong with shape to geotiff transformation");
// return;
//}
_logger.LogInformation($"Converting shape to geotiff"); //_logger.LogInformation("Downloading geotiff file");
geotiffItem = await _generalService.ShapeToGeotiff(shapeItem, 1, input.InputLayerName); //await _farmmapsApiService.DownloadItemAsync(geotiffItem.Code,
if (geotiffItem == null) // Path.Combine(DownloadFolder, $"{input.OutputFileName}.input_geotiff.zip"));
{ //inputItem = geotiffItem;
_logger.LogError("Something went wrong with shape to geotiff transformation"); ////End shape to geotiff transformation
return;
}
_logger.LogInformation("Downloading geotiff file");
await _farmmapsApiService.DownloadItemAsync(geotiffItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.input_geotiff.zip"));
} }
@ -218,16 +194,12 @@ namespace FarmmapsNbs
var targetNData = await _nitrogenService.CalculateTargetN(cropfieldItem, targetNItem, plantingDate, var targetNData = await _nitrogenService.CalculateTargetN(cropfieldItem, targetNItem, plantingDate,
measurementDate, input.PotatoPurposeType, input.TargetYield); measurementDate, input.PotatoPurposeType, input.TargetYield);
if (targetNData == null) if (targetNData == null) {
{
_logger.LogError("Something went wrong with TargetN calculation"); _logger.LogError("Something went wrong with TargetN calculation");
return; return;
} }
_logger.LogInformation($"TargetN: {targetNData.TargetN}"); _logger.LogInformation($"TargetN: {targetNData.TargetN}");
////Option to manually adjust the Target N, for test purposes only!
//targetNData.TargetN = 225;
//_logger.LogInformation($"TargetN adjusted: {targetNData.TargetN}");
var targetNDataPath = Path.Combine(DownloadFolder, $"{input.OutputFileName}.targetn.json"); var targetNDataPath = Path.Combine(DownloadFolder, $"{input.OutputFileName}.targetn.json");
@ -235,10 +207,9 @@ namespace FarmmapsNbs
_logger.LogInformation("Calculating uptake map"); _logger.LogInformation("Calculating uptake map");
var uptakeMapItem = var uptakeMapItem =
await _nitrogenService.CalculateUptakeMap(cropfieldItem, geotiffItem, plantingDate, await _nitrogenService.CalculateUptakeMap(cropfieldItem, inputItem, plantingDate,
measurementDate, input.InputVariable, input.InputLayerName); measurementDate, input.InputVariable, input.InputLayerName);
if (uptakeMapItem == null) if (uptakeMapItem == null) {
{
_logger.LogError("Something went wrong with creating the uptakeMap"); _logger.LogError("Something went wrong with creating the uptakeMap");
return; return;
} }
@ -250,11 +221,10 @@ namespace FarmmapsNbs
_logger.LogInformation("Calculating application map"); _logger.LogInformation("Calculating application map");
var applianceMapItem = var applianceMapItem =
await _nitrogenService.CalculateApplicationMap(cropfieldItem, geotiffItem, plantingDate, await _nitrogenService.CalculateApplicationMap(cropfieldItem, inputItem, plantingDate,
measurementDate, input.InputVariable, targetNData.TargetN, input.InputLayerName); measurementDate, input.InputVariable, targetNData.TargetN, input.InputLayerName);
if (applianceMapItem == null) if (applianceMapItem == null) {
{
_logger.LogError("Something went wrong with creating the applicationMap"); _logger.LogError("Something went wrong with creating the applicationMap");
return; return;
} }
@ -266,24 +236,20 @@ namespace FarmmapsNbs
//transforming tiff to shape //transforming tiff to shape
var tiffItem = applianceMapItem; var tiffItem = applianceMapItem;
if (tiffItem == null) if (tiffItem == null) {
{
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
//ApplicationMap (GEOTIFF) To Taskmap //ApplicationMap (GEOTIFF) To Taskmap
if (input.GenerateTaskmap) if (input.GenerateTaskmap) {
{
//GEOTIFF TO Taskmap //GEOTIFF TO Taskmap
_logger.LogInformation($"Converting geotiff to taskmap"); _logger.LogInformation($"Converting geotiff to taskmap");
var taskmap = (Item)null; var taskmap = (Item)null;
if (input.OutputType == "isoxml") if (input.OutputType == "isoxml") {
{
if (input.DdiCode == null) if (input.DdiCode == null) {
{
_logger.LogInformation("DDi not given. Using expected identifiers"); _logger.LogInformation("DDi not given. Using expected identifiers");
input.DdiCode = input.DdiCode = "0006"; input.DdiCode = input.DdiCode = "0006";
@ -293,9 +259,7 @@ namespace FarmmapsNbs
endPoint: input.EndPoint.ToString(Formatting.None), angle: input.Angle, precision: input.Precision, endPoint: input.EndPoint.ToString(Formatting.None), angle: input.Angle, precision: input.Precision,
cropTypeName: null, costumerName: null, ProductGroupName: null, productName: null, resolution: null, unitScale: null, maximumClasses: input.MaximumClasses); cropTypeName: null, costumerName: null, ProductGroupName: null, productName: null, resolution: null, unitScale: null, maximumClasses: input.MaximumClasses);
} } else {
else
{
taskmap = await _generalService.CreateTaskmap(cropfieldItem: cropfieldItem, tiffItem: applianceMapItem, outputType: input.OutputType, cellWidth: input.CellWidth, taskmap = await _generalService.CreateTaskmap(cropfieldItem: cropfieldItem, tiffItem: applianceMapItem, outputType: input.OutputType, cellWidth: input.CellWidth,
cellHeight: input.CellHeight, startPoint: input.StartPoint.ToString(Formatting.None), inputLayerName: input.InputLayerName, centered: input.Centered, cellHeight: input.CellHeight, startPoint: input.StartPoint.ToString(Formatting.None), inputLayerName: input.InputLayerName, centered: input.Centered,
endPoint: input.EndPoint.ToString(Formatting.None), angle: input.Angle, precision: input.Precision, maximumClasses: input.MaximumClasses); endPoint: input.EndPoint.ToString(Formatting.None), angle: input.Angle, precision: input.Precision, maximumClasses: input.MaximumClasses);
@ -303,8 +267,7 @@ namespace FarmmapsNbs
if (taskmap == null) if (taskmap == null) {
{
_logger.LogError("Something went wrong with geotiff to taskmap transformation"); _logger.LogError("Something went wrong with geotiff to taskmap transformation");
return; return;
} }
@ -320,29 +283,23 @@ namespace FarmmapsNbs
} }
// Functions to save previously created cropfields // Functions to save previously created cropfields
private void LoadSettings(string file) private void LoadSettings(string file) {
{ if (File.Exists(file)) {
if (File.Exists(file))
{
var jsonText = File.ReadAllText(file); var jsonText = File.ReadAllText(file);
_settings = JsonConvert.DeserializeObject<Settings>(jsonText); _settings = JsonConvert.DeserializeObject<Settings>(jsonText);
} } else {
else
{
_settings = new Settings(); _settings = new Settings();
} }
} }
private void SaveSettings(string file) private void SaveSettings(string file) {
{
if (_settings == null) if (_settings == null)
return; return;
var json = JsonConvert.SerializeObject(_settings); var json = JsonConvert.SerializeObject(_settings);
File.WriteAllText(file, json); File.WriteAllText(file, json);
} }
private void SaveInfo(string file) private void SaveInfo(string file) {
{
if (_settings == null) if (_settings == null)
return; return;

View File

@ -1,111 +1,59 @@
[ [
//{ {
// "UseCreatedCropfield": true, "UseCreatedCropfield": false,
// "file": "Scan_1_20190605.json", "file": "Scan_1_20190605_sample.json",
// "inputVariable": "irmi", "inputVariable": "irmi",
// "inputLayerName": "", "inputLayerName": "irmi",
// "outputFileName": "vranbs1", "outputFileName": "vranbs_sample",
// "fieldName": "testJson_irmi", "fieldName": "sampleJson_irmi",
// "storeSatelliteStatistics": true, "storeSatelliteStatistics": true,
// "plantingDate": "2019-04-18", "plantingDate": "2019-04-18",
// "measurementDate": "2019-06-05", "measurementDate": "2019-06-05",
// "potatoPurposeType": "consumption", "potatoPurposeType": "consumption",
// "targetYield": 45, "targetYield": 45,
// "geometryJson": { "geometryJson": {
// "type": "Polygon", "type": "Polygon",
// "coordinates": [ "coordinates": [
// [ [
// [ 3.40843828875524, 50.638966444680605 ], [ 5.63217247936348731, 51.96438066944019596 ],
// [ 3.408953272886064, 50.639197789621612 ], [ 5.6321047379532132, 51.96445630006819982 ],
// [ 3.409242951459603, 50.639469958681836 ], [ 5.63206782435562925, 51.96450152306518078 ],
// [ 3.409328782148028, 50.639612846807708 ], [ 5.63189463337882312, 51.96471369141583807 ],
// [ 3.409457528180712, 50.639789755314411 ], [ 5.63125445938590019, 51.96545230717740793 ],
// [ 3.409639918393741, 50.640014292074966 ], [ 5.63038475519850046, 51.96645153536461237 ],
// [ 3.409833037442765, 50.640211611372706 ], [ 5.6302190722686376, 51.96664178312045124 ],
// [ 3.410069071836049, 50.640395321698435 ], [ 5.63010295472675626, 51.96676711160860407 ],
// [ 3.410380208081761, 50.640572227259661 ], [ 5.63204023224759265, 51.96725135278578023 ],
// [ 3.410605513638958, 50.640715112034222 ], [ 5.63281523134503814, 51.96638856753320823 ],
// [ 3.411925160474145, 50.641177783561204 ], [ 5.63281527471734655, 51.96638851620966904 ],
// [ 3.411935889310142, 50.640728720085136 ], [ 5.63366926331355611, 51.96542171716968284 ],
// [ 3.412590348309737, 50.63948356709389 ], [ 5.63397637358524683, 51.96498159324188748 ],
// [ 3.413244807309242, 50.638224772339846 ], [ 5.6341135965418534, 51.96474743038492505 ],
// [ 3.413400375432099, 50.637901562841307 ], [ 5.63219031197733688, 51.96438405049333653 ],
// [ 3.413539850300779, 50.637449065809889 ], [ 5.63217541872332195, 51.96438123226843686 ],
// [ 3.413475477284437, 50.637418445552932 ], [ 5.63217247936348731, 51.96438066944019596 ]
// [ 3.40999396998362, 50.637449065810451 ], ]
// [ 3.409940325803365, 50.638102293212661 ], ]
// [ 3.409575545377398, 50.638483338338325 ], },
// [ 3.409060561246574, 50.638707881340494 ], "GenerateTaskmap": false
// [ 3.40843828875524, 50.638966444680605 ] }
// ] // "GenerateTaskmap": true,
// ] // "OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode
// }, // "Precision": "0",
// "MaximumClasses": "4",
// "GenerateTaskmap": true, // "DdiCode": "0006",
// "OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode // "CellWidth": "27",
// "Precision": "2", // "CellHeight": "10",
// "MaximumClasses": "4", // "Centered": "false",
// "DdiCode": "0006", // "StartPoint": {
// "CellWidth": "3", // "type": "Point",
// "CellHeight": "10", // "coordinates": [ 5.6322, 51.9644 ]
// "Centered": "true", // },
// "StartPoint": { // "EndPoint": { // if no angle
// "type": "Point", // "type": "Point",
// "coordinates": [ 3.409341600000000, 50.638991900000001 ] // "coordinates": [ 5.6341, 51.9647 ]
// }, // }
// "EndPoint": { // if no angle // //"Angle": "317.0" // if no endpoint
// "type": "Point",
// "coordinates": [ 3.411897000000000, 50.638981500000000 ]
// }
// //"Angle": "317.0" // if no endpoint
//},
{
"UseCreatedCropfield": false,
"file": "", // keep emptpy to use satellite image
"inputVariable": "wdvi",
"InputLayerName": "wdvi",
"outputFileName": "rtest1",
"fieldName": "test_satelliteWDVI",
"storeSatelliteStatistics": true,
"plantingDate": "2020-05-01",
"measurementDate": "2020-06-14",
"potatoPurposeType": "consumption",
"targetYield": 60,
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 4.960707146896585, 52.800583669708487 ],
[ 4.960645975538824, 52.800470217610922 ],
[ 4.962140695752897, 52.799177147194797 ],
[ 4.967523821195745, 52.801502400041208 ],
[ 4.966336768950911, 52.802543735879809 ],
[ 4.961711880764330, 52.801009996856429 ],
[ 4.960707146896585, 52.800583669708487 ]
]
]
},
"GenerateTaskmap": true,
"OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode
"Precision": "2",
"MaximumClasses": "4",
"DdiCode": "0006",
"CellWidth": "3",
"CellHeight": "10",
"Centered": "true",
"StartPoint": {
"type": "Point",
"coordinates": [ 4.960707146896585, 52.800583669708487 ]
},
"EndPoint": { // if no angle
"type": "Point",
"coordinates": [ 4.961711880764330, 52.801009996856429 ]
}
//"Angle": "317.0" // if no endpoint
}
//}
] ]

View File

@ -1,13 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework> <TargetFramework>netstandard1.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Update="appsettings.json"> <None Remove="appsettings.json" />
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <Content Include="appsettings.json">
</None> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</ItemGroup> </Content>
<None Remove="appsettings.secrets.json" />
<Content Include="appsettings.secrets.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project> </Project>

View File

@ -1,8 +1,25 @@
{ {
"Authority": "https://accounts.test.farmmaps.eu/", //There are three farmmaps environments, uncomment the environemnt you want to use with this sample client
"Endpoint": "https://test.farmmaps.eu/",
"BasePath": "api/v1", ////test environment
"DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", //"Authority": "https://accounts.test.farmmaps.eu/",
//"Endpoint": "https://test.farmmaps.eu/",
//"BasePath": "api/v1",
//"DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration",
////acceptance environment
//"Authority": "https://accounts.acc.farmmaps.eu/",
//"Endpoint": "https://acc.farmmaps.eu/",
//"BasePath": "api/v1",
//"DiscoveryEndpointUrl": "https://accounts.acc.farmmaps.eu/.well-known/openid-configuration",
//production environment
"authority": "https://accounts.farmmaps.eu/",
"endpoint": "https://farmmaps.eu/",
"basepath": "api/v1",
"discoveryendpointurl": "https://accounts.farmmaps.eu/.well-known/openid-configuration",
//overige info
"RedirectUri": "http://example.nl/api", "RedirectUri": "http://example.nl/api",
"Scopes": ["api"] "Scopes": [ "api" ]
} }