From 65a0398444c1302328f981e004d9c48612fa9073 Mon Sep 17 00:00:00 2001 From: Mark van der Wal Date: Mon, 6 Jul 2020 13:12:44 +0200 Subject: [PATCH] Implemented, tested geojson as 'input' --- FarmmapsApi/Constants.cs | 1 + FarmmapsNbs/NbsApplication.cs | 4 +- FarmmapsNbs/NitrogenInput.json | 114 +++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 2 deletions(-) diff --git a/FarmmapsApi/Constants.cs b/FarmmapsApi/Constants.cs index 1bae5eb..191fc88 100644 --- a/FarmmapsApi/Constants.cs +++ b/FarmmapsApi/Constants.cs @@ -9,6 +9,7 @@ namespace FarmmapsApiSamples public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield"; public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed"; public const string SHAPE_ITEMTYPE = "vnd.farmmaps.itemtype.shape"; + public const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson"; public const string VRANBS_TASK = "vnd.farmmaps.task.vranbs"; public const string VRAHERBICIDE_TASK = "vnd.farmmaps.task.vraherbicide"; diff --git a/FarmmapsNbs/NbsApplication.cs b/FarmmapsNbs/NbsApplication.cs index 0e22c6a..9e2e525 100644 --- a/FarmmapsNbs/NbsApplication.cs +++ b/FarmmapsNbs/NbsApplication.cs @@ -9,13 +9,13 @@ using FarmmapsApi.Services; using FarmmapsNbs.Models; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using static FarmmapsApiSamples.Constants; namespace FarmmapsNbs { public class NbsApplication : IApplication { private const string DownloadFolder = "Downloads"; - private const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson"; private readonly ILogger _logger; private readonly FarmmapsApiService _farmmapsApiService; @@ -81,7 +81,7 @@ namespace FarmmapsNbs var isGeoJson = input.File.Contains("json"); var dataPath = Path.Combine("Data", input.File); var shapeItem = isGeoJson ? - await _generalService.UploadDataAsync(uploadedRoot, GEOJSON_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File)): + await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File)): await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File)); if (shapeItem == null) diff --git a/FarmmapsNbs/NitrogenInput.json b/FarmmapsNbs/NitrogenInput.json index 9e068b7..7f69b17 100644 --- a/FarmmapsNbs/NitrogenInput.json +++ b/FarmmapsNbs/NitrogenInput.json @@ -8,5 +8,119 @@ "potatoPurposeType": "consumption", "targetYield": 45, "geometryJson": { "type": "Polygon", "coordinates": [ [ [ 3.40843828875524, 50.638966444680605 ], [ 3.408953272886064, 50.639197789621612 ], [ 3.409242951459603, 50.639469958681836 ], [ 3.409328782148028, 50.639612846807708 ], [ 3.409457528180712, 50.639789755314411 ], [ 3.409639918393741, 50.640014292074966 ], [ 3.409833037442765, 50.640211611372706 ], [ 3.410069071836049, 50.640395321698435 ], [ 3.410380208081761, 50.640572227259661 ], [ 3.410605513638958, 50.640715112034222 ], [ 3.411925160474145, 50.641177783561204 ], [ 3.411935889310142, 50.640728720085136 ], [ 3.412590348309737, 50.63948356709389 ], [ 3.413244807309242, 50.638224772339846 ], [ 3.413400375432099, 50.637901562841307 ], [ 3.413539850300779, 50.637449065809889 ], [ 3.413475477284437, 50.637418445552932 ], [ 3.40999396998362, 50.637449065810451 ], [ 3.409940325803365, 50.638102293212661 ], [ 3.409575545377398, 50.638483338338325 ], [ 3.409060561246574, 50.638707881340494 ], [ 3.40843828875524, 50.638966444680605 ] ] ] } + }, + { + "file": "Scan_1_20190605.zip", + "inputVariable": "irmi", + "outputFileName": "vranbs2", + "plantingDate": "2019-04-18", + "measurementDate": "2019-06-05", + "potatoPurposeType": "starch", + "targetYield": 45, + "geometryJson": { + "type": "Polygon", + "coordinates": [ + [ + [ 3.40843828875524, 50.638966444680605 ], + [ 3.408953272886064, 50.639197789621612 ], + [ 3.409242951459603, 50.639469958681836 ], + [ 3.409328782148028, 50.639612846807708 ], + [ 3.409457528180712, 50.639789755314411 ], + [ 3.409639918393741, 50.640014292074966 ], + [ 3.409833037442765, 50.640211611372706 ], + [ 3.410069071836049, 50.640395321698435 ], + [ 3.410380208081761, 50.640572227259661 ], + [ 3.410605513638958, 50.640715112034222 ], + [ 3.411925160474145, 50.641177783561204 ], + [ 3.411935889310142, 50.640728720085136 ], + [ 3.412590348309737, 50.63948356709389 ], + [ 3.413244807309242, 50.638224772339846 ], + [ 3.413400375432099, 50.637901562841307 ], + [ 3.413539850300779, 50.637449065809889 ], + [ 3.413475477284437, 50.637418445552932 ], + [ 3.40999396998362, 50.637449065810451 ], + [ 3.409940325803365, 50.638102293212661 ], + [ 3.409575545377398, 50.638483338338325 ], + [ 3.409060561246574, 50.638707881340494 ], + [ 3.40843828875524, 50.638966444680605 ] + ] + ] + } + }, + { + "file": "Scan_1_20190605.zip", + "inputVariable": "irmi", + "outputFileName": "vranbs3", + "plantingDate": "2019-04-18", + "measurementDate": "2019-06-20", + "potatoPurposeType": "starch", + "targetYield": 45, + "geometryJson": { + "type": "Polygon", + "coordinates": [ + [ + [ 3.40843828875524, 50.638966444680605 ], + [ 3.408953272886064, 50.639197789621612 ], + [ 3.409242951459603, 50.639469958681836 ], + [ 3.409328782148028, 50.639612846807708 ], + [ 3.409457528180712, 50.639789755314411 ], + [ 3.409639918393741, 50.640014292074966 ], + [ 3.409833037442765, 50.640211611372706 ], + [ 3.410069071836049, 50.640395321698435 ], + [ 3.410380208081761, 50.640572227259661 ], + [ 3.410605513638958, 50.640715112034222 ], + [ 3.411925160474145, 50.641177783561204 ], + [ 3.411935889310142, 50.640728720085136 ], + [ 3.412590348309737, 50.63948356709389 ], + [ 3.413244807309242, 50.638224772339846 ], + [ 3.413400375432099, 50.637901562841307 ], + [ 3.413539850300779, 50.637449065809889 ], + [ 3.413475477284437, 50.637418445552932 ], + [ 3.40999396998362, 50.637449065810451 ], + [ 3.409940325803365, 50.638102293212661 ], + [ 3.409575545377398, 50.638483338338325 ], + [ 3.409060561246574, 50.638707881340494 ], + [ 3.40843828875524, 50.638966444680605 ] + ] + ] + } + }, + { + "file": "Scan_1_20190605.zip", + "inputVariable": "irmi", + "outputFileName": "vranbs4", + "plantingDate": "2019-04-18", + "measurementDate": "2019-07-03", + "potatoPurposeType": "starch", + "targetYield": 45, + "geometryJson": { + "type": "Polygon", + "coordinates": [ + [ + [ 3.40843828875524, 50.638966444680605 ], + [ 3.408953272886064, 50.639197789621612 ], + [ 3.409242951459603, 50.639469958681836 ], + [ 3.409328782148028, 50.639612846807708 ], + [ 3.409457528180712, 50.639789755314411 ], + [ 3.409639918393741, 50.640014292074966 ], + [ 3.409833037442765, 50.640211611372706 ], + [ 3.410069071836049, 50.640395321698435 ], + [ 3.410380208081761, 50.640572227259661 ], + [ 3.410605513638958, 50.640715112034222 ], + [ 3.411925160474145, 50.641177783561204 ], + [ 3.411935889310142, 50.640728720085136 ], + [ 3.412590348309737, 50.63948356709389 ], + [ 3.413244807309242, 50.638224772339846 ], + [ 3.413400375432099, 50.637901562841307 ], + [ 3.413539850300779, 50.637449065809889 ], + [ 3.413475477284437, 50.637418445552932 ], + [ 3.40999396998362, 50.637449065810451 ], + [ 3.409940325803365, 50.638102293212661 ], + [ 3.409575545377398, 50.638483338338325 ], + [ 3.409060561246574, 50.638707881340494 ], + [ 3.40843828875524, 50.638966444680605 ] + ] + ] + } } ] \ No newline at end of file