Implemented, tested geojson as 'input'

This commit is contained in:
Mark van der Wal 2020-07-06 13:12:44 +02:00
parent 10b6cc8cd1
commit 65a0398444
3 changed files with 117 additions and 2 deletions

View File

@ -9,6 +9,7 @@ namespace FarmmapsApiSamples
public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield"; public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield";
public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed"; public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed";
public const string SHAPE_ITEMTYPE = "vnd.farmmaps.itemtype.shape"; 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 VRANBS_TASK = "vnd.farmmaps.task.vranbs";
public const string VRAHERBICIDE_TASK = "vnd.farmmaps.task.vraherbicide"; public const string VRAHERBICIDE_TASK = "vnd.farmmaps.task.vraherbicide";

View File

@ -9,13 +9,13 @@ using FarmmapsApi.Services;
using FarmmapsNbs.Models; using FarmmapsNbs.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
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 GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson";
private readonly ILogger<NbsApplication> _logger; private readonly ILogger<NbsApplication> _logger;
private readonly FarmmapsApiService _farmmapsApiService; private readonly FarmmapsApiService _farmmapsApiService;
@ -81,7 +81,7 @@ namespace FarmmapsNbs
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, 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)); await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File));
if (shapeItem == null) if (shapeItem == null)

View File

@ -8,5 +8,119 @@
"potatoPurposeType": "consumption", "potatoPurposeType": "consumption",
"targetYield": 45, "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 ] ] ] } "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 ]
]
]
}
} }
] ]