diff --git a/FarmmapsApi/Constants.cs b/FarmmapsApi/Constants.cs index b061c18..08b271c 100644 --- a/FarmmapsApi/Constants.cs +++ b/FarmmapsApi/Constants.cs @@ -8,6 +8,7 @@ namespace FarmmapsApiSamples public const string GEOTIFF_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.geotiff.processed"; public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield"; public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed"; + public const string ISOXML_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.iso11783.taskdata.processed"; 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"; diff --git a/FarmmapsApi/Services/GeneralService.cs b/FarmmapsApi/Services/GeneralService.cs index ce2b0be..5a2e17c 100644 --- a/FarmmapsApi/Services/GeneralService.cs +++ b/FarmmapsApi/Services/GeneralService.cs @@ -110,7 +110,7 @@ namespace FarmmapsApi.Services // Create taskmap based on width, height and direction public async Task CreateTaskmap(Item cropfieldItem, Item tiffItem, string outputType, string cellWidth, string cellHeight, - string startPoint, string ddiCode = "0001", string centered = "false", string endPoint = null, string angle = null, + string startPoint, string ddiCode = "0001", string centered = "false", string endPoint = null, string angle = null, string precision = null, string cropTypeName = null, string costumerName = null, string ProductGroupName = null, string productName = null, string resolution = null, string unitScale = null, string maximumClasses = null) @@ -126,9 +126,10 @@ namespace FarmmapsApi.Services if (outputType == "isoxml") taskmapRequest.attributes["ddiCode"] = ddiCode; // ddi is obligatory for isoxml, if not given set to 0001 if (angle == null) taskmapRequest.attributes["endPoint"] = endPoint; // Coordinates WGS84 if (endPoint == null) taskmapRequest.attributes["angle"] = angle; // degrees between 0.0 and 360.0 - //taskmapRequest.attributes["precision"] = precision; + // Optional attributes + if (precision != null) taskmapRequest.attributes["precision"] = precision; if (cropTypeName != null) taskmapRequest.attributes["cropTypeName"] = cropTypeName; if (costumerName != null) taskmapRequest.attributes["costumerName"] = costumerName; if (ProductGroupName != null) taskmapRequest.attributes["ProductGroupName"] = ProductGroupName; @@ -155,11 +156,24 @@ namespace FarmmapsApi.Services //the taskmap is a child of the input tiff var itemName = "Taskmap"; - var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode, + Item taskMapItem = null; + if (outputType == "isoxml") {taskMapItem = await FindChildItemAsync(tiffItem.ParentCode, + ISOXML_PROCESSED_ITEMTYPE, itemName); + } + else if (outputType== "shape") { + taskMapItem = await FindChildItemAsync(tiffItem.ParentCode, SHAPE_PROCESSED_ITEMTYPE, itemName); + } + else + { + _logger.LogError("OutputType not specified, could not determine if output should be shape or ISOXML"); + taskMapItem = null; + } + + if (taskMapItem == null) { - _logger.LogError("Could not find the shape taskmap as a child item under the input"); + _logger.LogError("Could not find the shape/isoxml taskmap as a child item under the input"); return null; } diff --git a/FarmmapsNbs/FarmmapsNbs.csproj b/FarmmapsNbs/FarmmapsNbs.csproj new file mode 100644 index 0000000..6e4a5ab --- /dev/null +++ b/FarmmapsNbs/FarmmapsNbs.csproj @@ -0,0 +1,27 @@ + + + + Exe + netcoreapp3.0 + + + + + Always + + + Always + + + Always + + + Always + + + + + + + + diff --git a/FarmmapsNbs/FarmmapsNbs.csproj.user b/FarmmapsNbs/FarmmapsNbs.csproj.user new file mode 100644 index 0000000..c41d825 --- /dev/null +++ b/FarmmapsNbs/FarmmapsNbs.csproj.user @@ -0,0 +1,10 @@ + + + + false + FarmmapsNbs + + + ProjectDebugger + + \ No newline at end of file diff --git a/FarmmapsNbs/InputData-NBS.json b/FarmmapsNbs/InputData-NBS.json new file mode 100644 index 0000000..6d5fcac --- /dev/null +++ b/FarmmapsNbs/InputData-NBS.json @@ -0,0 +1,41 @@ +[ + { + "UseCreatedCropfield": false, + "storeStatistics": false, + "file": "20210308 WDVI_Harpreet Singh.tif", + "inputVariable": "wdvi", + //"InputLayerName": "Band 1", + "outputFileName": "2021.03.08.Hapreet_Singh_wdvi08_03", + "plantingDate": "2020-04-15", + "measurementDate": "2020-06-27", + "potatoPurposeType": "consumption", + "targetYield": 27, + "fieldName": "Mahindra-Hapreet-Singh", + "geometryJson": { + "type": "Polygon", + "coordinates": [ + [ + [ 75.929090780177305, 31.639314978348551 ], + [ 75.931353489378182, 31.639409065494881 ], + [ 75.931432810729120, 31.638956841735819 ], + [ 75.929072617175663, 31.638879365370279 ], + [ 75.929090780177305, 31.639314978348551 ] + ] + ] + }, + "GenerateTaskmap": true, + "CellWidth": "3", + "CellHeight": "20", + "Centered": false, + "StartPoint": { + "type": "Point", + "coordinates": [ 75.931353489378182, 31.639409065494881 ] + }, + "EndPoint": { + "type": "Point", + "coordinates": [ 75.929090780177305, 31.639314978348551 ] + } // if no angle + + //"Angle": "317.0" // if no endpoint + } + ] \ No newline at end of file diff --git a/FarmmapsNbs/Models/NitrogenInput.cs b/FarmmapsNbs/Models/NitrogenInput.cs new file mode 100644 index 0000000..d82fdc2 --- /dev/null +++ b/FarmmapsNbs/Models/NitrogenInput.cs @@ -0,0 +1,30 @@ +using System; +using Newtonsoft.Json.Linq; + +namespace FarmmapsNbs.Models +{ + public class NitrogenInput + { + public bool UseCreatedCropfield { get; set; } + public string File { get; set; } + public string InputVariable { get; set; } + public string OutputFileName { get; set; } + public DateTime PlantingDate { get; set; } + public DateTime MeasurementDate { get; set; } + public string PotatoPurposeType { get; set; } + public int TargetYield { get; set; } + public JObject GeometryJson { get; set; } + public string InputLayerName { get; set; } + public string fieldName{ get; set; } + public bool storeSatelliteStatistics { get; set; } + public bool GenerateTaskmap { get; set; } + public string CellWidth { get; set; } + public string CellHeight { get; set; } + public bool Centered { get; set; } + public JObject StartPoint { get; set; } + public JObject EndPoint { get; set; } + public string Angle { get; set; } + + + } +} \ No newline at end of file diff --git a/FarmmapsNbs/Models/Settings.cs b/FarmmapsNbs/Models/Settings.cs new file mode 100644 index 0000000..40cd25d --- /dev/null +++ b/FarmmapsNbs/Models/Settings.cs @@ -0,0 +1,9 @@ +namespace FarmmapsNbs { + public class Settings { + public string CropfieldItemCode { get; set; } + public string SatelliteTaskCode { get; set; } + public string VanDerSatTaskCode { get; set; } + public string WatBalTaskCode { get; set; } + + } +} \ No newline at end of file diff --git a/FarmmapsNbs/Models/TargetNData.cs b/FarmmapsNbs/Models/TargetNData.cs new file mode 100644 index 0000000..d4aaea9 --- /dev/null +++ b/FarmmapsNbs/Models/TargetNData.cs @@ -0,0 +1,9 @@ +namespace FarmmapsNbs.Models +{ + public class TargetNData + { + public double TSum { get; set; } + public int TargetYield { get; set; } + public double TargetN { get; set; } + } +} \ No newline at end of file diff --git a/FarmmapsNbs/NbsApplication.cs b/FarmmapsNbs/NbsApplication.cs new file mode 100644 index 0000000..d7a5ab2 --- /dev/null +++ b/FarmmapsNbs/NbsApplication.cs @@ -0,0 +1,338 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using FarmmapsApi; +using FarmmapsApi.Models; +using FarmmapsApi.Services; +using FarmmapsNbs.Models; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using static FarmmapsApiSamples.Constants; + +namespace FarmmapsNbs +{ + public class NbsApplication : IApplication + { + private const string DownloadFolder = "Downloads"; + private const string SettingsFile = "settings.json"; + + private readonly ILogger _logger; + private readonly FarmmapsApiService _farmmapsApiService; + private readonly NitrogenService _nitrogenService; + private readonly GeneralService _generalService; + + private Settings _settings; + + public NbsApplication(ILogger logger, FarmmapsApiService farmmapsApiService, + GeneralService generalService, NitrogenService nitrogenService) + { + _logger = logger; + _farmmapsApiService = farmmapsApiService; + _generalService = generalService; + _nitrogenService = nitrogenService; + } + + public async Task RunAsync() + { + var nitrogenInputJson = File.ReadAllText("InputData-NBS.json"); //NitrogenInput.json + List nitrogenInputs = JsonConvert.DeserializeObject>(nitrogenInputJson); + + if (!Directory.Exists(DownloadFolder)) + Directory.CreateDirectory(DownloadFolder); + + // !! this call is needed the first time an api is called with a fresh clientid and secret !! + await _farmmapsApiService.GetCurrentUserCodeAsync(); + var roots = await _farmmapsApiService.GetCurrentUserRootsAsync(); + + foreach (var input in nitrogenInputs) + { + try + { + await Process(roots, input); + } + catch (Exception ex) + { + _logger.LogError(ex.Message); + } + } + } + + private async Task Process(List roots, NitrogenInput input) + { + + // !!specify if you are using an already created cropfield: + bool useCreatedCropfield = input. UseCreatedCropfield; + var plantingDate = input.PlantingDate; + var FieldName = input.fieldName; + bool StoreStatistics = input.storeSatelliteStatistics; + var measurementDate = input.MeasurementDate; + string settingsfile = $"Settings_{FieldName}.json"; + + LoadSettings(settingsfile); + + var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded"); + if (uploadedRoot == null) + { + _logger.LogError("Could not find a needed root item"); + return; + } + + var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive"); + if (myDriveRoot == null) + { + _logger.LogError("Could not find a needed root item"); + return; + } + + // Use already created cropfield or create new one + Item cropfieldItem; + if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.CropfieldItemCode)) + { + _logger.LogInformation("Creating cropfield"); + cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code, + $"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None)); + _settings.CropfieldItemCode = cropfieldItem.Code; + SaveSettings(settingsfile); + } + else + { + _logger.LogInformation("Cropfield already exists, trying to get it"); + cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); + } + + var geotiffItem = (Item)null; + + // No file input, use most recent satellite image + if (string.IsNullOrEmpty(input.File)) { + _logger.LogInformation("No specific data given, retrieving most recent satellite image"); + + // check if satellite task not yet done, do here and save taskcode + if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.SatelliteTaskCode)) { + var satelliteTaskCode = await _generalService.RunSatelliteTask(cropfieldItem); + _settings.SatelliteTaskCode = satelliteTaskCode; + SaveSettings(settingsfile); + } + + + // Select a particular satellite item from satelliteTask + Item satalliteItem = await _generalService.FindSatelliteItem(cropfieldItem, _settings.SatelliteTaskCode, FieldName, StoreStatistics); + + var satelliteBand = satalliteItem.Data["layers"][0]["name"]; + var satelliteStatistics = satalliteItem.Data["layers"][0]["renderer"]["band"]["statistics"]; + Console.WriteLine($"Satellite image date: {satalliteItem.DataDate}"); + //Console.WriteLine($"Satellite image statistics for band {satelliteBand}: {satelliteStatistics}"); + + //Store data to csv + if (StoreStatistics==true) { + var SatelliteFile = $"C:\\Akkerweb\\DataSatellite_{FieldName}.csv"; + var NewLineField = $"\"Field\":{FieldName}" + Environment.NewLine; + var NewLineDate = $"\"date\":{satalliteItem.DataDate}" + Environment.NewLine; + var i = 0; + foreach (var item in satelliteStatistics) { + //var NewLines2; + if (i == 0) { + File.AppendAllText(SatelliteFile, NewLineDate); + i++; + } + File.AppendAllText(SatelliteFile, $"{item}" + Environment.NewLine); + + } + } + + + // must be wdvi[1] + var inputType = (satalliteItem.Data["layers"] as JArray)?[1]["name"].ToString(); + if (string.IsNullOrEmpty(inputType)) { + _logger.LogError("Could not get the input type name from the satellite item"); + return; + } + + // download the geotiff + var SatelliteImageDate = (DateTime)satalliteItem.DataDate; + var SatelliteDate = SatelliteImageDate.ToString("yyyyMMdd"); + _logger.LogInformation("Downloading geotiff file"); + await _farmmapsApiService.DownloadItemAsync(satalliteItem.Code, + Path.Combine(DownloadFolder, $"nbs_inputSatelliteGeotiff_{input.OutputFileName}_{inputType}_{SatelliteDate}.zip")); + + // overwrite measurement date by date of satellite item + measurementDate = satalliteItem.DataDate.Value; + + geotiffItem = satalliteItem; + + + } + + + // (geo)tiff input: + else if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) { + _logger.LogInformation("input = tiff data"); + var dataPath = Path.Combine("Data", input.File); + geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath, + Path.GetFileNameWithoutExtension(input.File)); + + if (geotiffItem == null) { + _logger.LogError("Could not find item for uploaded data"); + return; + } + } + + // json/shape input + else { + var isGeoJson = input.File.Contains("json"); + var dataPath = Path.Combine("Data", input.File); + var shapeItem = isGeoJson ? + await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File)) : + await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File)); + + if (shapeItem == null) { + _logger.LogError("Could not find item for uploaded data"); + return; + } + + _logger.LogInformation($"Converting shape to geotiff"); + geotiffItem = await _generalService.ShapeToGeotiff(shapeItem); + if (geotiffItem == null) { + _logger.LogError("Something went wrong with shape to geotiff transformation"); + return; + } + + _logger.LogInformation("Downloading geotiff file"); + await _farmmapsApiService.DownloadItemAsync(geotiffItem.Code, + Path.Combine(DownloadFolder, $"{input.OutputFileName}.input_geotiff.zip")); + } + + + //// check if vandersat task not yet done, do here and save taskcode + //if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.VanDerSatTaskCode)) { + // var VanDerSatTaskCode = await _generalService.RunVanDerSatTask(cropfieldItem); + // _settings.VanDerSatTaskCode = VanDerSatTaskCode; + // SaveSettings(settingsfile); + //} + + //// Select a particular image item from VanDerSat + //Item VanDerSatItem = await _generalService.FindVanDerSatItem(cropfieldItem, _settings.VanDerSatTaskCode, FieldName, StoreStatistics); + + + //// download the geotiff + //_logger.LogInformation("Downloading geotiff file"); + //await _farmmapsApiService.DownloadItemAsync(VanDerSatItem.Code, + // Path.Combine(DownloadFolder, $"nbs_VanDerSatGeotiff_{input.OutputFileName}.zip")); + + _logger.LogInformation($"Calculating targetN with targetYield: {input.TargetYield}"); + var targetNItem = await _nitrogenService.CreateTargetNItem(cropfieldItem); + var targetNData = await _nitrogenService.CalculateTargetN(cropfieldItem, targetNItem, plantingDate, + measurementDate, input.PotatoPurposeType, input.TargetYield); + + if (targetNData == null) { + _logger.LogError("Something went wrong with TargetN calculation"); + return; + } + + _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"); + + await File.WriteAllTextAsync(targetNDataPath, JsonConvert.SerializeObject(targetNData, Formatting.Indented)); + + _logger.LogInformation("Calculating uptake map"); + var uptakeMapItem = + await _nitrogenService.CalculateUptakeMap(cropfieldItem, geotiffItem, plantingDate, + measurementDate, input.InputVariable, input.InputLayerName); + if (uptakeMapItem == null) { + _logger.LogError("Something went wrong with creating the uptakeMap"); + return; + } + + _logger.LogInformation("Downloading uptake map"); + await _farmmapsApiService.DownloadItemAsync(uptakeMapItem.Code, + Path.Combine(DownloadFolder, $"{input.OutputFileName}.uptake.zip")); + _logger.LogInformation("UptakeMap downloaded to {0}", Path.Combine(DownloadFolder, $"{input.OutputFileName}.uptake.zip")); + + _logger.LogInformation("Calculating application map"); + var applicationMapItem = + await _nitrogenService.CalculateApplicationMap(cropfieldItem, geotiffItem, plantingDate, + measurementDate, input.InputVariable, targetNData.TargetN, input.InputLayerName); + + if (applicationMapItem == null) { + _logger.LogError("Something went wrong with creating the applicationMap"); + return; + } + _logger.LogInformation("Downloading application map"); + await _farmmapsApiService.DownloadItemAsync(applicationMapItem.Code, + Path.Combine(DownloadFolder, $"{input.OutputFileName}.application.zip")); + _logger.LogInformation("Application map can be found in {0}", Path.Combine(DownloadFolder, $"{input.OutputFileName}.application.zip")); + + //transforming tiff to shape + var tiffItem = applicationMapItem; + + if (tiffItem == null) { + _logger.LogError("Could not find item for uploaded data"); + return; + } + + //_logger.LogInformation($"Converting geotiff to shape"); + //var taskmap = await _generalService.GeotiffToShape(tiffItem); + //if (taskmap == null) { + // _logger.LogError("Something went wrong with geotiff to shape transformation"); + // return; + //} + + //ApplicationMap (GEOTIFF) To Taskmap + _logger.LogInformation($"Converting geotiff to taskmap"); + var taskmap = await _generalService.CreateTaskmap(cropfieldItem, tiffItem, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None), + input.Centered.ToString(), input.EndPoint.ToString(Formatting.None), input.Angle); + + if (taskmap == null) + { + _logger.LogError("Something went wrong with geotiff to shape transformation"); + return; + } + + + _logger.LogInformation("Downloading taskmap"); + await _farmmapsApiService.DownloadItemAsync(taskmap.Code, + Path.Combine(DownloadFolder, $"{input.OutputFileName}.taskmap.zip")); + + + } + + + // Functions to save previously created cropfields + private void LoadSettings(string file) + { + if (File.Exists(file)) + { + var jsonText = File.ReadAllText(file); + _settings = JsonConvert.DeserializeObject(jsonText); + } + else + { + _settings = new Settings(); + } + } + + private void SaveSettings(string file) + { + if (_settings == null) + return; + + var json = JsonConvert.SerializeObject(_settings); + File.WriteAllText(file, json); + } + private void SaveInfo(string file) { + if (_settings == null) + return; + + var json = JsonConvert.SerializeObject(_settings); + File.WriteAllText(file, json); + + } + + } + } \ No newline at end of file diff --git a/FarmmapsNbs/NitrogenInput.json b/FarmmapsNbs/NitrogenInput.json new file mode 100644 index 0000000..6e2afe5 --- /dev/null +++ b/FarmmapsNbs/NitrogenInput.json @@ -0,0 +1,310 @@ +[ + { + "file": "Scan_1_20190605.json", + "inputVariable": "irmi", + "outputFileName": "vranbs1", + "plantingDate": "2019-04-18", + "measurementDate": "2019-06-05", + "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": "[...].json", + //"inputVariable": "wdvi", + //"outputFileName": "20201211_Mahindra", + //"plantingDate": "2020-11-25", + //"measurementDate": "2020-12-08", + //"potatoPurposeType": "consumption", + //"targetYield": 45, + //"geometryJson": { + // "type": "Polygon", + // "coordinates": [ + // [ + // [ 75.4652734163369, 31.26328617861426 ], + // [ 75.46527659380338, 31.26437743805827 ], + // [ 75.46494267602188, 31.26438166160194 ], + // [ 75.46493257618651, 31.26462192072676 ], + // [ 75.46438242791261, 31.26462132638865 ], + // [ 75.46438225728252, 31.26334267015003 ], + // [ 75.46448543502072, 31.26333463263533 ], + // [ 75.46448842093658, 31.26302891147988 ], + // [ 75.46507631089699, 31.26299589154944 ], + // [ 75.46509039016291, 31.26329023051392 ], + // [ 75.4652734163369, 31.26328617861426 ] + // ] + // ] + //} + //} + + //}, + //{ + // "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", + { + "file": "", // keep emptpy to use satellite image + "inputVariable": "wdvi", + "InputLayerName": "wdvi", + "outputFileName": "rtest1", + "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 ] + ] + ] + } + } + //, + //{ + // "file": "", // keep emptpy to use satellite image + // "inputVariable": "wdvi", + // "InputLayerName": "wdvi", + // "outputFileName": "mtest1", + // "plantingDate": "2020-04-01", + // "measurementDate": "2020-06-24", + // "potatoPurposeType": "consumption", + // "targetYield": 60, + // "geometryJson": { + // "type": "Polygon", + // "coordinates": [ + // [ + // [ 3.575458869234128, 51.308707885669762 ], + // [ 3.575508957999423, 51.30878478562019 ], + // [ 3.576188404403633, 51.309372997559777 ], + // [ 3.576188872410267, 51.309374219701091 ], + // [ 3.576210290749152, 51.309430091473608 ], + // [ 3.57621266537704, 51.309483685674898 ], + // [ 3.576213477455834, 51.309502027981374 ], + // [ 3.577543136860447, 51.310682367527122 ], + // [ 3.57796629328866, 51.31104321405175 ], + // [ 3.578442479292087, 51.311449273042747 ], + // [ 3.57866702353106, 51.311636072786726 ], + // [ 3.57880446997978, 51.31157117599529 ], + // [ 3.579155910205885, 51.311863542729718 ], + // [ 3.579175814007489, 51.311875435159394 ], + // [ 3.579293885246395, 51.311936532835396 ], + // [ 3.579413896180069, 51.311998649478575 ], + // [ 3.579514543462617, 51.312041110734917 ], + // [ 3.579611760655688, 51.312082118352606 ], + // [ 3.579635115371588, 51.312093949652223 ], + // [ 3.579793143414486, 51.312189437140432 ], + // [ 3.579966991648108, 51.312286148850511 ], + // [ 3.580079704980967, 51.312332458349751 ], + // [ 3.580203717638148, 51.312336471368539 ], + // [ 3.580307101018293, 51.312330239539847 ], + // [ 3.580383836270609, 51.312317097185243 ], + // [ 3.580505207977176, 51.312279163554869 ], + // [ 3.580610387713855, 51.312233723091026 ], + // [ 3.5806309754483, 51.312226093729677 ], + // [ 3.580638516049738, 51.312223727082049 ], + // [ 3.58075536599681, 51.312186990706344 ], + // [ 3.580787745633303, 51.312176820129551 ], + // [ 3.580829682241423, 51.312167665428959 ], + // [ 3.58086828456562, 51.312162614898625 ], + // [ 3.580980493636721, 51.312147935609723 ], + // [ 3.581014352632766, 51.312145662592656 ], + // [ 3.581028980583245, 51.312145592849248 ], + // [ 3.581119189823368, 51.312145103215911 ], + // [ 3.581195330198145, 51.312144693075908 ], + // [ 3.581243537809229, 51.312148741603245 ], + // [ 3.58132480221972, 51.312163110548383 ], + // [ 3.581426517039001, 51.312181089466016 ], + // [ 3.581448095953263, 51.312184910295024 ], + // [ 3.581474337475052, 51.312191038736145 ], + // [ 3.581709405982819, 51.312260068944951 ], + // [ 3.581727319558337, 51.312266163697757 ], + // [ 3.581753583356718, 51.312276407881612 ], + // [ 3.581841655772683, 51.312310743468075 ], + // [ 3.581878851795624, 51.312325234405343 ], + // [ 3.581905889860924, 51.312338260798654 ], + // [ 3.581906254501594, 51.312338472113815 ], + // [ 3.582048236499295, 51.312422439022804 ], + // [ 3.58189849928915, 51.312481944577037 ], + // [ 3.583044298383354, 51.312095780444281 ], + // [ 3.582984006671231, 51.312017283925279 ], + // [ 3.582743535862999, 51.311699343434064 ], + // [ 3.582628599916243, 51.311582190756774 ], + // [ 3.581446834435509, 51.310511259982569 ], + // [ 3.580621864908701, 51.309767270412806 ], + // [ 3.579610575760466, 51.308860440593946 ], + // [ 3.579112608916012, 51.308394999612226 ], + // [ 3.578688808506157, 51.307968441218165 ], + // [ 3.578394256007207, 51.307644098092617 ], + // [ 3.578355980318371, 51.307607614964702 ], + // [ 3.578217977585775, 51.307654179547846 ], + // [ 3.577480636332469, 51.307921035607997 ], + // [ 3.575695560441006, 51.308577167973212 ], + // [ 3.575668643609169, 51.30855384769157 ], + // [ 3.575666204524265, 51.308551734020703 ], + // [ 3.575506397192348, 51.308609906947261 ], + // [ 3.575459139533024, 51.308653178431456 ], + // [ 3.575458869234128, 51.308707885669762 ] + // ] + // ] + // } + //} + //, + //{ + // "file": "Scan_1_20190605.zip", + // "inputVariable": "irmi", + // "InputLayerName": "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", + //} + //, + //{ + // "file": "Scan_1_20190605.zip", + // "inputVariable": "irmi", + // "InputLayerName": "", + // "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 diff --git a/FarmmapsNbs/NitrogenService.cs b/FarmmapsNbs/NitrogenService.cs new file mode 100644 index 0000000..96416ef --- /dev/null +++ b/FarmmapsNbs/NitrogenService.cs @@ -0,0 +1,191 @@ +using System; +using System.Globalization; +using System.Threading.Tasks; +using FarmmapsApi.Models; +using FarmmapsApi.Services; +using FarmmapsNbs.Models; +using Microsoft.Extensions.Logging; +using static FarmmapsApi.Extensions; +using static FarmmapsApiSamples.Constants; + +namespace FarmmapsNbs +{ + public class NitrogenService + { + private readonly ILogger _logger; + private readonly FarmmapsApiService _farmmapsApiService; + private readonly GeneralService _generalService; + + public NitrogenService(ILogger logger, FarmmapsApiService farmmapsApiService, + GeneralService generalService) + { + _logger = logger; + _farmmapsApiService = farmmapsApiService; + _generalService = generalService; + } + + public async Task CreateTargetNItem(Item cropfieldItem) + { + var itemRequest = new ItemRequest() + { + ParentCode = cropfieldItem.ParentCode, + ItemType = USERINPUT_ITEMTYPE, + Name = "TargetN" + }; + return await _farmmapsApiService.CreateItemAsync(itemRequest); + } + + /// + /// Calculates TargetN, makes the assumption the cropfield and user.input(targetn) item have the same parent + /// + /// The cropfield to base the calculations on + /// The targetN item to save calculations in + /// The date the crop is planted + /// The date the measurements are taken + /// The crop purpose + /// The target yield input for the TargetN calculation + /// The TargetN + public async Task CalculateTargetN(Item cropfieldItem, Item targetNItem, DateTime plantingDate, + DateTime measurementDate, string purposeType, int targetYield) + { + var nbsTargetNRequest = new TaskRequest {TaskType = VRANBS_TASK}; + nbsTargetNRequest.attributes["operation"] = "targetn"; + nbsTargetNRequest.attributes["inputCode"] = targetNItem.Code; + nbsTargetNRequest.attributes["plantingDate"] = plantingDate.ToString("o"); + nbsTargetNRequest.attributes["measurementDate"] = measurementDate.ToString("o"); + nbsTargetNRequest.attributes["purposeType"] = purposeType.ToLower(); + nbsTargetNRequest.attributes["targetYield"] = targetYield.ToString(); + string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsTargetNRequest); + + await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) => + { + var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); + if (itemTaskStatus.IsFinished) + tokenSource.Cancel(); + }); + + var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); + if(itemTask.State == ItemTaskState.Error) + { + _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); + return null; + } + + var item = await _farmmapsApiService.GetItemAsync(targetNItem.Code); + return item.Data.ToObject(); + } + + /// + /// Calculates the uptake map based on the given inputs + /// + /// The cropfield to base the calculations on + /// + /// The date the crop is planted + /// The date the measurements are taken + /// Data type, could be yara, ci, irmi or wdvi + /// Column name in which the sensor value is stored + /// + public async Task CalculateUptakeMap(Item cropfieldItem, Item inputItem, DateTime plantingDate, + DateTime measurementDate, string inputType, string inputLayerName) + { + var nbsUptakeMapRequest = new TaskRequest {TaskType = VRANBS_TASK}; + nbsUptakeMapRequest.attributes["operation"] = "uptake"; + nbsUptakeMapRequest.attributes["inputCode"] = inputItem.Code; + nbsUptakeMapRequest.attributes["plantingDate"] = plantingDate.ToString("o"); + nbsUptakeMapRequest.attributes["measurementDate"] = measurementDate.ToString("o"); + nbsUptakeMapRequest.attributes["inputType"] = inputType.ToLower(); + if (!(string.IsNullOrEmpty(inputLayerName))) nbsUptakeMapRequest.attributes["inputLayerName"] = inputLayerName; + //toevoeging FS. Kolom IRMI hernoemd als IMI. Deze wordt niet automatisch herkend. En moet dus gespecificeerd worden. + + + + string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsUptakeMapRequest); + + await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => + { + var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); + _logger.LogInformation($"Calculating uptake map; status: {itemTaskStatus.State}"); + if (itemTaskStatus.IsFinished) + tokenSource.Cancel(); + }); + + var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); + if (itemTask.State == ItemTaskState.Error) + { + _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); + return null; + } + + var itemName = "VRANbs uptake"; + var uptakeMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code, + GEOTIFF_PROCESSED_ITEMTYPE, itemName, + i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) && + i.Name.ToLower().Contains(itemName.ToLower())); + + if (uptakeMapItem == null) + { + _logger.LogError("Could not find the uptake geotiff child item under cropfield"); + return null; + } + + return uptakeMapItem; + } + + + /// + /// Creates the nitrogen application map based on given input data + /// + /// The cropfield to base the calculations on + /// The farmmaps item containing the geotiff data + /// The date the crop is planted + /// The date the measurements are taken + /// The inputtype to use, could be yara, ci, irmi or wdvi + /// The target nitrogen to use for the calculations + /// + public async Task CalculateApplicationMap(Item cropfieldItem, Item inputItem, DateTime plantingDate, + DateTime measurementDate, string inputType, double targetN, string inputLayerName) + { + var nbsApplicationMapRequest = new TaskRequest {TaskType = VRANBS_TASK}; + nbsApplicationMapRequest.attributes["operation"] = "application"; + nbsApplicationMapRequest.attributes["inputCode"] = inputItem.Code; + nbsApplicationMapRequest.attributes["plantingDate"] = plantingDate.ToString("o"); + nbsApplicationMapRequest.attributes["measurementDate"] = measurementDate.ToString("o"); + nbsApplicationMapRequest.attributes["inputCode"] = inputItem.Code; + nbsApplicationMapRequest.attributes["inputType"] = inputType.ToLower(); + nbsApplicationMapRequest.attributes["targetN"] = targetN.ToString(CultureInfo.InvariantCulture); + if (!(string.IsNullOrEmpty(inputLayerName))) nbsApplicationMapRequest.attributes["inputLayerName"] = inputLayerName; + + string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsApplicationMapRequest); + + await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => + { + var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); + _logger.LogInformation($"Calculating application map; status: {itemTaskStatus.State}"); + if (itemTaskStatus.IsFinished) + tokenSource.Cancel(); + }); + + + + var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); + if(itemTask.State == ItemTaskState.Error) + { + _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); + return null; + } + + var itemName = $"VRANbs application"; + var applicationMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code, + GEOTIFF_PROCESSED_ITEMTYPE, itemName, + i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) && + i.Name.ToLower().Contains(itemName.ToLower())); + if (applicationMapItem == null) + { + _logger.LogError("Could not find the application map geotiff child item under cropfield"); + return null; + } + + return applicationMapItem; + } + } +} \ No newline at end of file diff --git a/FarmmapsPoten_AVRapi/Program.cs b/FarmmapsNbs/Program.cs similarity index 79% rename from FarmmapsPoten_AVRapi/Program.cs rename to FarmmapsNbs/Program.cs index 1003080..596637a 100644 --- a/FarmmapsPoten_AVRapi/Program.cs +++ b/FarmmapsNbs/Program.cs @@ -3,9 +3,9 @@ using FarmmapsApi; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -namespace FarmmapsVRApoten +namespace FarmmapsNbs { - class Program : FarmmapsProgram + class Program : FarmmapsProgram { private static async Task Main(string[] args) { @@ -17,7 +17,7 @@ namespace FarmmapsVRApoten serviceCollection.AddLogging(opts => opts .AddConsole() .AddFilter("System.Net.Http", LogLevel.Warning)) - .AddTransient(); + .AddTransient(); } } } \ No newline at end of file diff --git a/FarmmapsPoten/Models/PotenInput.cs b/FarmmapsPoten/Models/PotenInput.cs index 57c71c4..0814ce3 100644 --- a/FarmmapsPoten/Models/PotenInput.cs +++ b/FarmmapsPoten/Models/PotenInput.cs @@ -25,6 +25,8 @@ namespace FarmmapsPoten.Models public JObject StartPoint { get; set; } public JObject EndPoint { get; set; } public string Angle { get; set; } + public string Precision { get; set; } + public string MaximumClasses { get; set; } } } \ No newline at end of file diff --git a/FarmmapsPoten/PotenApplication.cs b/FarmmapsPoten/PotenApplication.cs index d80c398..2ec8375 100644 --- a/FarmmapsPoten/PotenApplication.cs +++ b/FarmmapsPoten/PotenApplication.cs @@ -175,14 +175,7 @@ namespace FarmmapsVRApoten _logger.LogInformation(File.Exists(finalOutput) ? "Download application map completed." : "Something went wrong while downloading."); - - ////GEOTIFF TO SHAPE - //_logger.LogInformation($"Converting geotiff to shape"); - //var geotiffToShapeItem= await _generalService.GeotiffToShape(applianceMapItem); - //if (taskmap == null) { - // _logger.LogError("Something went wrong with geotiff to shape transformation"); - // return; - //} + if(input.GenerateTaskmap) { @@ -192,12 +185,17 @@ namespace FarmmapsVRApoten var taskmap = (Item)null; if (input.OutputType == "isoxml") { - taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.OutputType, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None), - input.DdiCode, input.Centered, input.EndPoint.ToString(Formatting.None), input.Angle); + + taskmap = await _generalService.CreateTaskmap(cropfieldItem: cropfieldItem, tiffItem: applianceMapItem, outputType: input.OutputType, cellWidth: input.CellWidth, + cellHeight: input.CellHeight, startPoint: input.StartPoint.ToString(Formatting.None), ddiCode: input.DdiCode, centered: input.Centered, + 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); + } else { - taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.OutputType, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None), - null, input.Centered, input.EndPoint.ToString(Formatting.None), input.Angle); + taskmap = await _generalService.CreateTaskmap(cropfieldItem: cropfieldItem, tiffItem: applianceMapItem, outputType: input.OutputType, cellWidth: input.CellWidth, + cellHeight: input.CellHeight, startPoint: input.StartPoint.ToString(Formatting.None), centered: input.Centered, + endPoint: input.EndPoint.ToString(Formatting.None), angle: input.Angle, precision: input.Precision, maximumClasses: input.MaximumClasses); } diff --git a/FarmmapsPoten/PotenInput.json b/FarmmapsPoten/PotenInput.json index 9e6bd92..764e62c 100644 --- a/FarmmapsPoten/PotenInput.json +++ b/FarmmapsPoten/PotenInput.json @@ -15,284 +15,6 @@ // [ // [ 6.3070655, 53.3623397 ], // [ 6.3070875, 53.3623898 ], - // [ 6.3071092, 53.3624398 ], - // [ 6.3071312, 53.3624898 ], - // [ 6.3071531, 53.3625399 ], - // [ 6.3071749, 53.3625899 ], - // [ 6.3071968, 53.36264 ], - // [ 6.3072186, 53.36269 ], - // [ 6.3072393, 53.3627389 ], - // [ 6.3072598, 53.3627879 ], - // [ 6.3072803, 53.3628367 ], - // [ 6.3073008, 53.3628856 ], - // [ 6.3073215, 53.3629345 ], - // [ 6.307342, 53.3629834 ], - // [ 6.3073625, 53.3630324 ], - // [ 6.3073832, 53.3630812 ], - // [ 6.3074037, 53.3631301 ], - // [ 6.3074242, 53.363179 ], - // [ 6.3074447, 53.3632279 ], - // [ 6.3074654, 53.3632768 ], - // [ 6.3074859, 53.3633257 ], - // [ 6.3075064, 53.3633746 ], - // [ 6.3075271, 53.3634235 ], - // [ 6.3075476, 53.3634724 ], - // [ 6.3075681, 53.3635213 ], - // [ 6.3075886, 53.3635702 ], - // [ 6.3076093, 53.3636191 ], - // [ 6.3076609, 53.3637669 ], - // [ 6.3076735, 53.3638141 ], - // [ 6.3076717, 53.3638452 ], - // [ 6.3076566, 53.3638765 ], - // [ 6.3076265, 53.3639037 ], - // [ 6.3075848, 53.3639245 ], - // [ 6.3075321, 53.3639382 ], - // [ 6.3074494, 53.3639508 ], - // [ 6.3073665, 53.3639632 ], - // [ 6.3072835, 53.3639758 ], - // [ 6.3072006, 53.3639884 ], - // [ 6.3071179, 53.3640008 ], - // [ 6.307035, 53.3640134 ], - // [ 6.306952, 53.3640258 ], - // [ 6.3068693, 53.3640384 ], - // [ 6.3067864, 53.3640509 ], - // [ 6.3067035, 53.3640634 ], - // [ 6.3066207, 53.3640759 ], - // [ 6.3065378, 53.3640884 ], - // [ 6.3064549, 53.364101 ], - // [ 6.306372, 53.3641135 ], - // [ 6.3062892, 53.364126 ], - // [ 6.3062063, 53.3641385 ], - // [ 6.3061234, 53.364151 ], - // [ 6.305889, 53.3641875 ], - // [ 6.3058018, 53.3642004 ], - // [ 6.3057146, 53.3642134 ], - // [ 6.3056273, 53.3642265 ], - // [ 6.3055401, 53.3642395 ], - // [ 6.3054529, 53.3642525 ], - // [ 6.3053655, 53.3642655 ], - // [ 6.3052782, 53.3642785 ], - // [ 6.3051975, 53.3642908 ], - // [ 6.3051167, 53.3643032 ], - // [ 6.3050358, 53.3643154 ], - // [ 6.304955, 53.3643277 ], - // [ 6.3048741, 53.3643401 ], - // [ 6.3047933, 53.3643523 ], - // [ 6.3047126, 53.3643647 ], - // [ 6.3046316, 53.364377 ], - // [ 6.3045509, 53.3643893 ], - // [ 6.3044701, 53.3644016 ], - // [ 6.3043892, 53.3644139 ], - // [ 6.3043086, 53.3644261 ], - // [ 6.304228, 53.3644382 ], - // [ 6.3041476, 53.3644503 ], - // [ 6.304067, 53.3644624 ], - // [ 6.3039864, 53.3644746 ], - // [ 6.3039059, 53.3644868 ], - // [ 6.3038253, 53.3644989 ], - // [ 6.3037447, 53.3645111 ], - // [ 6.3036641, 53.3645232 ], - // [ 6.3035835, 53.3645353 ], - // [ 6.303503, 53.3645474 ], - // [ 6.3034224, 53.3645596 ], - // [ 6.3033418, 53.3645717 ], - // [ 6.3032344, 53.3645896 ], - // [ 6.3029993, 53.364623 ], - // [ 6.3028959, 53.3646389 ], - // [ 6.3027925, 53.3646549 ], - // [ 6.3026889, 53.3646708 ], - // [ 6.3025855, 53.3646868 ], - // [ 6.3024821, 53.3647026 ], - // [ 6.3024042, 53.3647144 ], - // [ 6.3023261, 53.3647261 ], - // [ 6.3022482, 53.3647378 ], - // [ 6.3021702, 53.3647495 ], - // [ 6.3020923, 53.3647612 ], - // [ 6.3020142, 53.364773 ], - // [ 6.3019363, 53.3647847 ], - // [ 6.3018585, 53.3647964 ], - // [ 6.3017804, 53.3648081 ], - // [ 6.3017025, 53.3648198 ], - // [ 6.3016245, 53.3648315 ], - // [ 6.3015466, 53.3648433 ], - // [ 6.3014687, 53.364855 ], - // [ 6.3013906, 53.3648667 ], - // [ 6.3013128, 53.3648784 ], - // [ 6.3012347, 53.3648901 ], - // [ 6.3011568, 53.3649018 ], - // [ 6.3010788, 53.3649136 ], - // [ 6.3010009, 53.3649253 ], - // [ 6.300923, 53.364937 ], - // [ 6.3008449, 53.3649487 ], - // [ 6.300767, 53.3649604 ], - // [ 6.300689, 53.3649721 ], - // [ 6.3006111, 53.3649839 ], - // [ 6.300533, 53.3649956 ], - // [ 6.3004552, 53.3650073 ], - // [ 6.3003771, 53.365019 ], - // [ 6.3002992, 53.3650307 ], - // [ 6.3002213, 53.3650425 ], - // [ 6.3001433, 53.3650542 ], - // [ 6.3000654, 53.3650659 ], - // [ 6.2999843, 53.3650783 ], - // [ 6.2999033, 53.3650905 ], - // [ 6.2998224, 53.3651029 ], - // [ 6.2997415, 53.3651151 ], - // [ 6.2996603, 53.3651274 ], - // [ 6.2995794, 53.3651398 ], - // [ 6.2994985, 53.365152 ], - // [ 6.2994175, 53.3651644 ], - // [ 6.2993364, 53.3651767 ], - // [ 6.2992623, 53.3651849 ], - // [ 6.2992157, 53.3651857 ], - // [ 6.2991679, 53.365182 ], - // [ 6.2991157, 53.3651694 ], - // [ 6.2990734, 53.3651492 ], - // [ 6.2990423, 53.3651248 ], - // [ 6.299008, 53.3650764 ], - // [ 6.2989616, 53.3649669 ], - // [ 6.2989414, 53.3649136 ], - // [ 6.2989213, 53.3648604 ], - // [ 6.2989011, 53.3648072 ], - // [ 6.298881, 53.3647538 ], - // [ 6.2988608, 53.3647006 ], - // [ 6.2988407, 53.3646474 ], - // [ 6.2988206, 53.3645941 ], - // [ 6.2987995, 53.3645407 ], - // [ 6.2987785, 53.3644873 ], - // [ 6.2987574, 53.3644339 ], - // [ 6.2987364, 53.3643805 ], - // [ 6.2987153, 53.3643271 ], - // [ 6.2986943, 53.3642738 ], - // [ 6.2986731, 53.3642204 ], - // [ 6.298654, 53.364171 ], - // [ 6.2986349, 53.3641217 ], - // [ 6.2986159, 53.3640723 ], - // [ 6.2985968, 53.3640229 ], - // [ 6.2985777, 53.3639736 ], - // [ 6.2985587, 53.3639242 ], - // [ 6.2985396, 53.3638748 ], - // [ 6.2985205, 53.3638254 ], - // [ 6.2985015, 53.3637761 ], - // [ 6.2984826, 53.3637267 ], - // [ 6.2984571, 53.3636525 ], - // [ 6.2984554, 53.3636239 ], - // [ 6.2984678, 53.3635953 ], - // [ 6.2984948, 53.3635675 ], - // [ 6.2985616, 53.3635415 ], - // [ 6.2986411, 53.3635329 ], - // [ 6.2987148, 53.363522 ], - // [ 6.2987885, 53.3635112 ], - // [ 6.2988625, 53.3635003 ], - // [ 6.2989362, 53.3634895 ], - // [ 6.29901, 53.3634786 ], - // [ 6.2990837, 53.3634678 ], - // [ 6.2991574, 53.363457 ], - // [ 6.2992312, 53.3634461 ], - // [ 6.2993049, 53.3634353 ], - // [ 6.2993787, 53.3634244 ], - // [ 6.2994524, 53.3634136 ], - // [ 6.2995262, 53.3634028 ], - // [ 6.2995999, 53.3633919 ], - // [ 6.2996737, 53.3633811 ], - // [ 6.2997474, 53.3633702 ], - // [ 6.2998211, 53.3633594 ], - // [ 6.2998949, 53.3633486 ], - // [ 6.2999686, 53.3633376 ], - // [ 6.3000424, 53.3633268 ], - // [ 6.3001161, 53.3633159 ], - // [ 6.3001899, 53.3633051 ], - // [ 6.3002636, 53.3632943 ], - // [ 6.3003374, 53.3632834 ], - // [ 6.3004111, 53.3632726 ], - // [ 6.3004848, 53.3632617 ], - // [ 6.3005588, 53.3632509 ], - // [ 6.3006325, 53.36324 ], - // [ 6.3007063, 53.3632292 ], - // [ 6.30078, 53.3632184 ], - // [ 6.3008537, 53.3632075 ], - // [ 6.3009275, 53.3631967 ], - // [ 6.3010012, 53.3631858 ], - // [ 6.301075, 53.363175 ], - // [ 6.3011487, 53.3631642 ], - // [ 6.3012225, 53.3631533 ], - // [ 6.3012962, 53.3631425 ], - // [ 6.30137, 53.3631316 ], - // [ 6.3014437, 53.3631208 ], - // [ 6.3015174, 53.36311 ], - // [ 6.3015912, 53.3630991 ], - // [ 6.3016649, 53.3630883 ], - // [ 6.3017387, 53.3630774 ], - // [ 6.3018124, 53.3630666 ], - // [ 6.3018862, 53.3630558 ], - // [ 6.3019599, 53.3630449 ], - // [ 6.3020337, 53.3630341 ], - // [ 6.3021074, 53.3630232 ], - // [ 6.3021811, 53.3630124 ], - // [ 6.3022549, 53.3630016 ], - // [ 6.3023286, 53.3629907 ], - // [ 6.3024026, 53.3629799 ], - // [ 6.3024763, 53.362969 ], - // [ 6.30255, 53.3629582 ], - // [ 6.3026238, 53.3629474 ], - // [ 6.3026975, 53.3629365 ], - // [ 6.3027713, 53.3629256 ], - // [ 6.302845, 53.3629147 ], - // [ 6.3029188, 53.3629039 ], - // [ 6.3029925, 53.362893 ], - // [ 6.3030663, 53.3628822 ], - // [ 6.30314, 53.3628714 ], - // [ 6.3032137, 53.3628605 ], - // [ 6.3032875, 53.3628497 ], - // [ 6.3033612, 53.3628388 ], - // [ 6.303435, 53.362828 ], - // [ 6.3035087, 53.3628172 ], - // [ 6.3035825, 53.3628063 ], - // [ 6.3036562, 53.3627955 ], - // [ 6.30373, 53.3627846 ], - // [ 6.3038037, 53.3627738 ], - // [ 6.3038774, 53.362763 ], - // [ 6.3039512, 53.3627521 ], - // [ 6.3040249, 53.3627413 ], - // [ 6.3040987, 53.3627304 ], - // [ 6.3041724, 53.3627196 ], - // [ 6.3042462, 53.3627088 ], - // [ 6.3043199, 53.3626979 ], - // [ 6.3043937, 53.3626871 ], - // [ 6.3044674, 53.3626762 ], - // [ 6.3045413, 53.3626654 ], - // [ 6.3046151, 53.3626545 ], - // [ 6.3046888, 53.3626436 ], - // [ 6.3047626, 53.3626328 ], - // [ 6.3048363, 53.3626219 ], - // [ 6.30491, 53.3626111 ], - // [ 6.3049838, 53.3626002 ], - // [ 6.3050575, 53.3625894 ], - // [ 6.3051313, 53.3625786 ], - // [ 6.305205, 53.3625677 ], - // [ 6.3052788, 53.3625569 ], - // [ 6.3053525, 53.362546 ], - // [ 6.3054263, 53.3625352 ], - // [ 6.3055, 53.3625244 ], - // [ 6.3055737, 53.3625135 ], - // [ 6.3056475, 53.3625027 ], - // [ 6.3057212, 53.3624918 ], - // [ 6.305795, 53.362481 ], - // [ 6.3058687, 53.3624701 ], - // [ 6.3059425, 53.3624593 ], - // [ 6.3060162, 53.3624485 ], - // [ 6.30609, 53.3624376 ], - // [ 6.3061637, 53.3624268 ], - // [ 6.3062374, 53.3624158 ], - // [ 6.3063112, 53.362405 ], - // [ 6.3063849, 53.3623942 ], - // [ 6.3064587, 53.3623833 ], - // [ 6.3065324, 53.3623725 ], - // [ 6.3066062, 53.3623616 ], - // [ 6.3066799, 53.3623508 ], - // [ 6.3067537, 53.36234 ], - // [ 6.3068274, 53.3623291 ], - // [ 6.3069011, 53.3623183 ], // [ 6.3069749, 53.3623074 ], // [ 6.3070314, 53.3623125 ], // [ 6.3070655, 53.3623397 ] @@ -319,14 +41,14 @@ //} { - "File": "PlantingSampleDataLutum_TEST2.zip", - "OutputFileName": "2021.03.15_vraPoten_SampleData", + "File": "PlantingSampleDataLutum.zip", + "OutputFileName": "2021.04.09_vraPoten_SampleData4", "FieldName": "lutum", "PlantingYear": 2021, "MeanDensity": "30", "Variation": "20", "UseShadow": false, - "CountPerArea": true, + "CountPerArea": false, "geometryJson": { "type": "Polygon", "coordinates": [ @@ -341,8 +63,10 @@ }, "GenerateTaskmap": true, - "OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode - "DdiCode": "0001", + "OutputType": "isoxml", // "shape" or "isoxml" if isoxml also add ddiCode + "Precision": "2", + "MaximumClasses": "4", + "DdiCode": "0016", "CellWidth": "3", "CellHeight": "10", "Centered": "true", @@ -351,11 +75,11 @@ //"coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1 //"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2 //"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3 - "coordinates": [ 5.668375834141733, 52.527202407445586 ] // 4 + "coordinates": [ 5.671623092321491, 52.529463163999097 ] // 4 }, "EndPoint": { "type": "Point", - "coordinates": [ 5.668263398897563, 52.529744573890817 ] // 1 + "coordinates": [ 5.668860417036520, 52.529299990602986 ] // 1 //"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2 //"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3 //"coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4 diff --git a/FarmmapsPoten_AVRapi/Data/PlantingSampleDataLutum.json b/FarmmapsPoten_AVRapi/Data/PlantingSampleDataLutum.json deleted file mode 100644 index 7414170..0000000 --- a/FarmmapsPoten_AVRapi/Data/PlantingSampleDataLutum.json +++ /dev/null @@ -1,302 +0,0 @@ -{ -"type": "FeatureCollection", -"name": "PlantingSampleDataLutum", -"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, -"features": [ -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669006678383711, 52.529290221274948 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.669006104248043, 52.529200349555097 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.669005530115061, 52.529110477833399 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669004955984766, 52.529020606109889 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.669004381857157, 52.528930734384545 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669003807732236, 52.528840862657354 ] } }, -{ "type": "Feature", "properties": { "lutum": 12 }, "geometry": { "type": "Point", "coordinates": [ 5.66900323361, 52.528750990928309 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669002659490453, 52.528661119197444 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669002085373592, 52.528571247464789 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669001511259415, 52.528481375730252 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669000937147927, 52.528391503993873 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669000363039124, 52.52830163225569 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669154039708354, 52.529289871032709 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669153465272641, 52.529199999313761 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669152890839613, 52.529110127592965 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.669152316409275, 52.529020255870378 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669151741981626, 52.528930384145944 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669151167556664, 52.528840512419642 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.66915059313439, 52.528750640691563 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669150018714802, 52.528660768961629 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.669149444297904, 52.528570897229841 ] } }, -{ "type": "Feature", "properties": { "lutum": 13 }, "geometry": { "type": "Point", "coordinates": [ 5.669148869883696, 52.528481025496269 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669148295472175, 52.528391153760822 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.66914772106334, 52.528301282023527 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669147146657193, 52.528211410284435 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669146572253736, 52.528121538543502 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669145997852967, 52.528031666800764 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669145423454884, 52.527941795056144 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669301401030309, 52.529289520607428 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.66930082629455, 52.52919964888941 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669300251561478, 52.529109777169573 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669299676831097, 52.529019905447882 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669299102103404, 52.528930033724393 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669298527378404, 52.528840161999021 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669297952656091, 52.528750290271873 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669297377936467, 52.528660418542835 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669296803219534, 52.528570546811963 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669296228505289, 52.528480675079251 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669295653793735, 52.528390803344763 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669295079084868, 52.52830093160842 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669294504378692, 52.528211059870216 ] } }, -{ "type": "Feature", "properties": { "lutum": 14 }, "geometry": { "type": "Point", "coordinates": [ 5.669293929675204, 52.528121188130193 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669293354974407, 52.528031316388351 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669292780276298, 52.527941444644689 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669448762349575, 52.529289169999203 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669448187313771, 52.529199298282116 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669447612280653, 52.529109426563181 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.669447037250229, 52.529019554842385 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669446462222496, 52.52892968311982 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669445887197454, 52.528839811395386 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669445312175103, 52.528749939669105 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.669444737155444, 52.528660067941011 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669444162138473, 52.528570196211071 ] } }, -{ "type": "Feature", "properties": { "lutum": 15 }, "geometry": { "type": "Point", "coordinates": [ 5.669443587124193, 52.528480324479311 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669443012112604, 52.528390452745711 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669442437103707, 52.528300581010306 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669441862097501, 52.528210709273012 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669441287093983, 52.52812083753394 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669440712093158, 52.528030965793008 ] } }, -{ "type": "Feature", "properties": { "lutum": 16 }, "geometry": { "type": "Point", "coordinates": [ 5.669440137095023, 52.527941094050242 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669596123666151, 52.529288819207963 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.6695955483303, 52.5291989474918 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669594972997138, 52.529109075773768 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669594397666672, 52.529019204053945 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669593822338896, 52.52892933233224 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.669593247013813, 52.528839460608751 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669592671691423, 52.528749588883372 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669592096371725, 52.528659717156224 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.66959152105472, 52.528569845427207 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669590945740404, 52.528479973696371 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669590370428786, 52.528390101963666 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669589795119855, 52.528300230229171 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669589219813616, 52.528210358492849 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669588644510072, 52.528120486754638 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669588069209219, 52.52803061501465 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.669587493911057, 52.527940743272772 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669743484980033, 52.52928846823373 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.669742909344135, 52.529198596518491 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669742333710931, 52.529108724801389 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669741758080422, 52.529018853082476 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669741182452603, 52.528928981361695 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.669740606827482, 52.528839109639122 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.669740031205053, 52.528749237914688 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.669739455585318, 52.528659366188421 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669738879968274, 52.528569494460349 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669738304353925, 52.528479622730416 ] } }, -{ "type": "Feature", "properties": { "lutum": 17 }, "geometry": { "type": "Point", "coordinates": [ 5.66973772874227, 52.528389750998656 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.66973715313331, 52.528299879265084 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669736577527043, 52.528210007529651 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.669736001923469, 52.528120135792392 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669735426322587, 52.528030264053307 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669890846291222, 52.529288117076518 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.669890270355278, 52.529198245362174 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.669889694422031, 52.529108373646018 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669889118491477, 52.529018501928007 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.669888542563618, 52.528928630208178 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.669887966638455, 52.528838758486494 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.669887390715987, 52.528748886762969 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.669886814796213, 52.528659015037654 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669886238879136, 52.528569143310477 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669885662964753, 52.528479271581489 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669885087053065, 52.528389399850646 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669884511144072, 52.528299528117998 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.669883935237774, 52.528209656383481 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.66988335933417, 52.528119784647131 ] } }, -{ "type": "Feature", "properties": { "lutum": 18 }, "geometry": { "type": "Point", "coordinates": [ 5.669882783433263, 52.528029912908977 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670038207599717, 52.529287765736285 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.670037631363726, 52.529197894022879 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670037055130432, 52.529108022307639 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670036478899838, 52.529018150590574 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.670035902671936, 52.528928278871632 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.670035326446734, 52.528838407150914 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670034750224229, 52.528748535428306 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670034174004417, 52.528658663703865 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670033597787302, 52.528568791977627 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670033021572887, 52.528478920249526 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670032445361164, 52.528389048519642 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670031869152139, 52.528299176787897 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670031292945811, 52.528209305054318 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670030716742176, 52.528119433318885 ] } }, -{ "type": "Feature", "properties": { "lutum": 19 }, "geometry": { "type": "Point", "coordinates": [ 5.670030140541242, 52.52802956158164 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670186145444245, 52.529377285923772 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670185568905514, 52.52928741421308 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670184992369477, 52.52919754250059 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670184415836139, 52.529107670786267 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670183839305502, 52.529017799070111 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670183262777561, 52.528927927352115 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670182686252317, 52.528838055632299 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670182109729772, 52.528748183910643 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.670181533209922, 52.52865831218714 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670180956692772, 52.528568440461825 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670180380178322, 52.528478568734663 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670179803666567, 52.52838869700566 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670179227157511, 52.528298825274803 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670178650651151, 52.528208953542183 ] } }, -{ "type": "Feature", "properties": { "lutum": 20 }, "geometry": { "type": "Point", "coordinates": [ 5.67017807414749, 52.528119081807688 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670177497646527, 52.528029210071367 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670333507047393, 52.529376934216629 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670332930208612, 52.529287062506896 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670332353372531, 52.529197190795308 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670331776539151, 52.52910731908193 ] } }, -{ "type": "Feature", "properties": { "lutum": 21 }, "geometry": { "type": "Point", "coordinates": [ 5.670331199708469, 52.529017447366684 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670330622880485, 52.528927575649611 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670330046055202, 52.528837703930698 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670329469232617, 52.528747832209973 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670328892412731, 52.528657960487401 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670328315595544, 52.528568088762988 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.67032773878106, 52.528478217036756 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670327161969271, 52.528388345308677 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670326585160184, 52.528298473578765 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670326008353794, 52.52820860184702 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670325431550103, 52.528118730113469 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670324854749113, 52.528028858378079 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.67048086864784, 52.529376582326506 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670480291509012, 52.529286710617704 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670479714372884, 52.529196838907055 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670479137239461, 52.529106967194558 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670478560108735, 52.529017095480263 ] } }, -{ "type": "Feature", "properties": { "lutum": 22 }, "geometry": { "type": "Point", "coordinates": [ 5.670477982980711, 52.5289272237641 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670477405855387, 52.528837352046096 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670476828732764, 52.528747480326295 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.67047625161284, 52.528657608604661 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670475674495618, 52.528567736881193 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670475097381098, 52.528477865155843 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670474520269277, 52.528387993428701 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670473943160156, 52.528298121699713 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670473366053738, 52.52820824996892 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670472788950019, 52.528118378236279 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670472211849, 52.528028506501805 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670628230245586, 52.529376230253412 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670627652806711, 52.529286358545527 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670627075370538, 52.529196486835779 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670626497937069, 52.529106615124242 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670625920506301, 52.52901674341085 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670625343078235, 52.528926871695603 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670624765652872, 52.528836999978552 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670624188230208, 52.528747128259667 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670623610810248, 52.528657256538921 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670623033392991, 52.528567384816377 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670622455978436, 52.528477513091964 ] } }, -{ "type": "Feature", "properties": { "lutum": 23 }, "geometry": { "type": "Point", "coordinates": [ 5.670621878566583, 52.528387641365747 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670621301157429, 52.52829776963771 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.67062072375098, 52.528207897907812 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670620146347232, 52.528118026176088 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670619568946186, 52.528028154442524 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670775591840631, 52.529375877997303 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670775014101707, 52.529286006290334 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670774436365489, 52.529196134581525 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670773858631976, 52.529106262870911 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670773280901165, 52.52901639115845 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670772703173058, 52.52892651944412 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670772125447654, 52.528836647727985 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.670771547724952, 52.528746776010017 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670770970004954, 52.528656904290216 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670770392287662, 52.528567032568581 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670769814573072, 52.528477160845142 ] } }, -{ "type": "Feature", "properties": { "lutum": 24 }, "geometry": { "type": "Point", "coordinates": [ 5.670769236861187, 52.528387289119834 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670768659152, 52.528297417392693 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670768081445522, 52.528207545663754 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670767503741745, 52.528117673932925 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670766926040671, 52.528027802200249 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.67092295343297, 52.529375525558216 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.670922375394001, 52.52928565385217 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.670921797357738, 52.529195782144292 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.670921219324179, 52.529105910434581 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.670920641293326, 52.529016038723007 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670920063265176, 52.528926167009637 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.670919485239732, 52.528836295294447 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670918907216992, 52.52874642357736 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670918329196958, 52.528656551858511 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670917751179629, 52.528566680137807 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.670917173165005, 52.52847680841527 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670916595153083, 52.528386936690872 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.67091601714387, 52.528297064964669 ] } }, -{ "type": "Feature", "properties": { "lutum": 25 }, "geometry": { "type": "Point", "coordinates": [ 5.670915439137358, 52.528207193236646 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.670914861133554, 52.528117321506784 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.670914283132454, 52.528027449775095 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671070315022605, 52.529375172936099 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671069736683591, 52.529285301230992 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671069158347279, 52.529195429524037 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.671068580013677, 52.529105557815264 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671068001682782, 52.529015686104621 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671067423354591, 52.52892581439216 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671066845029107, 52.528835942677908 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.67106626670633, 52.528746070961773 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.671065688386258, 52.528656199243834 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671065110068891, 52.528566327524032 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.671064531754232, 52.528476455802441 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.67106395344228, 52.528386584078959 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.671063375133032, 52.528296712353679 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671062796826493, 52.528206840626574 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671062218522659, 52.528116968897628 ] } }, -{ "type": "Feature", "properties": { "lutum": 26 }, "geometry": { "type": "Point", "coordinates": [ 5.671061640221531, 52.528027097166849 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671217676609535, 52.529374820131018 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671217097970472, 52.52928494842682 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671216519334117, 52.529195076720818 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671215940700469, 52.529105205012932 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.67121536206953, 52.529015333303256 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671214783441298, 52.52892546159174 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671214204815774, 52.528835589878348 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.67121362619296, 52.528745718163179 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.671213047572849, 52.528655846446135 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671212468955447, 52.528565974727286 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671211890340752, 52.528476103006554 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671211311728769, 52.52838623128406 ] } }, -{ "type": "Feature", "properties": { "lutum": 27 }, "geometry": { "type": "Point", "coordinates": [ 5.67121073311949, 52.528296359559697 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671210154512919, 52.528206487833543 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671209575909057, 52.528116616105528 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671208997307901, 52.528026744375651 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671365038193755, 52.529374467142929 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671364459254646, 52.529284595439655 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671363880318245, 52.529194723734562 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671363301384553, 52.529104852027658 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671362722453573, 52.529014980318877 ] } }, -{ "type": "Feature", "properties": { "lutum": 28 }, "geometry": { "type": "Point", "coordinates": [ 5.671362143525299, 52.528925108608256 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671361564599734, 52.528835236895866 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671360985676879, 52.528745365181578 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671360406756732, 52.528655493465472 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671359827839296, 52.528565621747525 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671359248924568, 52.528475750027788 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671358670012548, 52.528385878306167 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671358091103239, 52.528296006582757 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671357512196637, 52.528206134857442 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671356933292747, 52.528116263130357 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671512399775269, 52.529374113971883 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671511820536112, 52.529284242269519 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671511241299665, 52.529194370565364 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.67151066206593, 52.52910449885934 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671510082834905, 52.529014627151504 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.67150950360659, 52.528924755441842 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671508924380984, 52.528834883730326 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671508345158092, 52.528745012016955 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671507765937908, 52.528655140301815 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671507186720435, 52.528565268584806 ] } }, -{ "type": "Feature", "properties": { "lutum": 33 }, "geometry": { "type": "Point", "coordinates": [ 5.671506607505673, 52.528475396865979 ] } }, -{ "type": "Feature", "properties": { "lutum": 33 }, "geometry": { "type": "Point", "coordinates": [ 5.671506028293621, 52.528385525145282 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.67150544908428, 52.528295653422774 ] } }, -{ "type": "Feature", "properties": { "lutum": 29 }, "geometry": { "type": "Point", "coordinates": [ 5.671504869877649, 52.52820578169846 ] } }, -{ "type": "Feature", "properties": { "lutum": 33 }, "geometry": { "type": "Point", "coordinates": [ 5.671504290673729, 52.528115909972264 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671658602278375, 52.52919401721315 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671658022744594, 52.529104145508029 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.671657443213525, 52.529014273801138 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.67165686368517, 52.528924402092414 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671656284159525, 52.52883453038185 ] } }, -{ "type": "Feature", "properties": { "lutum": 34 }, "geometry": { "type": "Point", "coordinates": [ 5.671655704636593, 52.528744658669403 ] } }, -{ "type": "Feature", "properties": { "lutum": 34 }, "geometry": { "type": "Point", "coordinates": [ 5.671655125116374, 52.528654786955173 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671654545598865, 52.528564915239095 ] } }, -{ "type": "Feature", "properties": { "lutum": 31 }, "geometry": { "type": "Point", "coordinates": [ 5.671653966084067, 52.528475043521155 ] } }, -{ "type": "Feature", "properties": { "lutum": 30 }, "geometry": { "type": "Point", "coordinates": [ 5.671653386571983, 52.528385171801425 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.67165280706261, 52.528295300079861 ] } }, -{ "type": "Feature", "properties": { "lutum": 32 }, "geometry": { "type": "Point", "coordinates": [ 5.67165222755595, 52.528205428356415 ] } }, -{ "type": "Feature", "properties": { "lutum": 33 }, "geometry": { "type": "Point", "coordinates": [ 5.671651648051999, 52.528115556631185 ] } }, -{ "type": "Feature", "properties": { "lutum": 34 }, "geometry": { "type": "Point", "coordinates": [ 5.671800165038228, 52.528294946553906 ] } }, -{ "type": "Feature", "properties": { "lutum": 33 }, "geometry": { "type": "Point", "coordinates": [ 5.671799585231536, 52.528205074831419 ] } }, -{ "type": "Feature", "properties": { "lutum": 34 }, "geometry": { "type": "Point", "coordinates": [ 5.671799005427561, 52.528115203107113 ] } } -] -} diff --git a/FarmmapsPoten_AVRapi/Data/PlantingSampleDataLutum.zip b/FarmmapsPoten_AVRapi/Data/PlantingSampleDataLutum.zip deleted file mode 100644 index 2c83115..0000000 Binary files a/FarmmapsPoten_AVRapi/Data/PlantingSampleDataLutum.zip and /dev/null differ diff --git a/FarmmapsPoten_AVRapi/FarmmapsPoten_AVRapi.csproj b/FarmmapsPoten_AVRapi/FarmmapsPoten_AVRapi.csproj deleted file mode 100644 index edb3d3c..0000000 --- a/FarmmapsPoten_AVRapi/FarmmapsPoten_AVRapi.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - Exe - netcoreapp3.1 - - - - - Always - - - Always - - - PreserveNewest - - - - - - - - diff --git a/FarmmapsPoten_AVRapi/Models/PotenInputAVR.cs b/FarmmapsPoten_AVRapi/Models/PotenInputAVR.cs deleted file mode 100644 index 0bb2876..0000000 --- a/FarmmapsPoten_AVRapi/Models/PotenInputAVR.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Newtonsoft.Json.Linq; - -namespace FarmmapsPoten_AVRapi.Models -{ - public class PotenInputAVR - { - public string File { get; set; } - public string OutputFileName { get; set; } - public string FieldName { get; set; } - public int PlantingYear { get; set; } - public string MeanDensity { get; set; } - public string Variation { get; set; } - public bool UseShadow { get; set; } - public bool ConvertToCountPerArea { get; set; } - public string Rijbreedte_m { get; set; } - public JObject GeometryJson { get; set; } - - public bool GenerateTaskmap { get; set; } - public string CellWidth { get; set; } - public string CellHeight { get; set; } - public JObject StartPoint { get; set; } - public JObject EndPoint { get; set; } - public string Angle { get; set; } - - } -} \ No newline at end of file diff --git a/FarmmapsPoten_AVRapi/PotenApplicationAVR.cs b/FarmmapsPoten_AVRapi/PotenApplicationAVR.cs deleted file mode 100644 index 295ad21..0000000 --- a/FarmmapsPoten_AVRapi/PotenApplicationAVR.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using FarmmapsApi; -using FarmmapsApi.Models; -using FarmmapsApi.Services; -using FarmmapsPoten_AVRapi.Models; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using static FarmmapsApiSamples.Constants; - - -namespace FarmmapsVRApoten -{ - public class PotenApplicationAVR : IApplication - { - private const string DownloadFolder = "Downloads"; - - private readonly ILogger _logger; - private readonly FarmmapsApiService _farmmapsApiService; - private readonly PotenServiceAVR _potenService; - private readonly GeneralService _generalService; - - - public PotenApplicationAVR(ILogger logger, FarmmapsApiService farmmapsApiService, - GeneralService generalService, PotenServiceAVR potenService) - { - _logger = logger; - _farmmapsApiService = farmmapsApiService; - _generalService = generalService; - _potenService = potenService; - } - - public async Task RunAsync() - { - // read field data from separate json file - var VRAPotenInputJson = File.ReadAllText("PotenInputAVR.json"); - List potenInputs = JsonConvert.DeserializeObject>(VRAPotenInputJson); - - - if (!Directory.Exists(DownloadFolder)) - Directory.CreateDirectory(DownloadFolder); - - // !! this call is needed the first time an api is called with a fresh clientid and secret !! - await _farmmapsApiService.GetCurrentUserCodeAsync(); - var roots = await _farmmapsApiService.GetCurrentUserRootsAsync(); - - foreach (var input in potenInputs) - { - try - { - await Process(roots, input); - } - catch (Exception ex) - { - _logger.LogError(ex.Message); - } - } - } - - private async Task Process(List roots, PotenInputAVR input) - { - var meanDensity = input.MeanDensity; - var variation = input.Variation; - var fieldName = input.FieldName; - bool useShadow = input.UseShadow; - bool convertToCountPerArea = input.ConvertToCountPerArea; - string rijBreedte_m = input.Rijbreedte_m; - - var myDrive = roots.SingleOrDefault(r => r.Name == "My drive"); - if (myDrive == null) - { - _logger.LogError("Could not find a needed root item"); - return; - } - - var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded"); - if (uploadedRoot == null) - { - _logger.LogError("Could not find a needed root item"); - return; - } - - _logger.LogInformation("Creating cropfield"); - - var cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, - $"VRA Poten cropfield {input.OutputFileName}", input.PlantingYear, - input.GeometryJson.ToString(Formatting.None)); - - //Calculating shadow map - if (useShadow) - { - _logger.LogInformation("Calculate shadow map for field"); - var shadowItem = await _generalService.RunShadowTask(cropfieldItem); - if (shadowItem == null) - { - _logger.LogError("Something went wrong while obtaining the shadow map"); - return; - } - - _logger.LogInformation("Downloading shadow map"); - await _farmmapsApiService.DownloadItemAsync(shadowItem.Code, - Path.Combine(DownloadFolder, $"{input.OutputFileName}.shadow.zip")); - } - - _logger.LogInformation("Looking for local data to use"); - var localDataAvailable = input.File; - var geotiffItem = (Item)null; - - - if (String.IsNullOrEmpty(localDataAvailable)) - { - _logger.LogInformation("Could not find item for uploaded data, using BOFEK"); - - //Retreiving BOFEK - _logger.LogInformation("Get BOFEK for field"); - var bofekItem = await _generalService.RunBofekTask(cropfieldItem); - if (bofekItem == null) - { - _logger.LogError("Something went wrong while obtaining the BOFEK data"); - return; - } - - _logger.LogInformation("Downloading Bofek map"); - await _farmmapsApiService.DownloadItemAsync(bofekItem.Code, - Path.Combine(DownloadFolder, $"{input.OutputFileName}.BOFEK.zip")); - } - else if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) - { - _logger.LogInformation("input = tiff data"); - var dataPath = Path.Combine("Data", input.File); - geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath, - Path.GetFileNameWithoutExtension(input.File)); - - if (geotiffItem == null) - { - _logger.LogError("Could not find item for uploaded data"); - return; - } - } - else - { - var isGeoJson = input.File.Contains("json"); - var dataPath = Path.Combine("Data", input.File); - var shapeItem = isGeoJson - ? await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, - Path.GetFileNameWithoutExtension(input.File)) - : await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, - Path.GetFileNameWithoutExtension(input.File)); - - if (shapeItem == null) - { - _logger.LogError("Something went wrong while searching for the shape file"); - return; - } - - // transform shape to geotiff as VRA poten only supports tiff input item - _logger.LogInformation($"Converting shape to geotiff"); - - geotiffItem = await _generalService.ShapeToGeotiff(shapeItem); - if (geotiffItem == null) - { - _logger.LogError("Something went wrong with shape to geotiff transformation"); - return; - } - - _logger.LogInformation("Downloading geotiff file"); - await _farmmapsApiService.DownloadItemAsync(geotiffItem.Code, - Path.Combine(DownloadFolder, $"VRApoten_inputGeotiff_{input.OutputFileName}.zip")); - } - - - - // create appliance map - _logger.LogInformation("Calculating application map"); - - // INPUT IS NEEDED as GEOTIFF - var applianceMapItem = - await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation); - - if (applianceMapItem == null) - { - return; - } - - _logger.LogInformation("Downloading application map"); - await _farmmapsApiService.DownloadItemAsync(applianceMapItem.Code, - Path.Combine(DownloadFolder, $"VRApoten_appliancemap_{input.OutputFileName}.zip")); - - string finalOutput = Path.Combine(DownloadFolder, $"VRApoten_appliancemap_{input.OutputFileName}.zip"); - _logger.LogInformation(File.Exists(finalOutput) - ? "Download application map completed." - : "Something went wrong while downloading."); - - - // if convertToCountPerArea == True, than recalculate pootafstand in cm to # of poters/m2 from the geotiffItem with the use of the zoneringsTask - if (convertToCountPerArea) - { - applianceMapItem = - await _potenService.ConvertToCountPerAreaTroughZonering(cropfieldItem, applianceMapItem, input.Rijbreedte_m); - - } - - - //Appliancemap (GEOTIFF) TO Taskmap - if (input.GenerateTaskmap == true) - { - _logger.LogInformation($"Converting geotiff to taskmap"); - var taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None), - input.EndPoint.ToString(Formatting.None), input.Angle); - if (taskmap == null) - { - _logger.LogError("Something went wrong with geotiff to shape transformation"); - return; - } - - - _logger.LogInformation("Downloading taskmap"); - await _farmmapsApiService.DownloadItemAsync(taskmap.Code, - Path.Combine(DownloadFolder, $"VRApoten_taskmap_{input.OutputFileName}.zip")); - } - - - } - } -} \ No newline at end of file diff --git a/FarmmapsPoten_AVRapi/PotenInputAVR.json b/FarmmapsPoten_AVRapi/PotenInputAVR.json deleted file mode 100644 index 757844a..0000000 --- a/FarmmapsPoten_AVRapi/PotenInputAVR.json +++ /dev/null @@ -1,41 +0,0 @@ -[ - { - "File": "PlantingSampleDataLutum.zip", - "OutputFileName": "20210216_SampleData_CovertArea", - "FieldName": "lutum", - "PlantingYear": 2021, - "MeanDensity": "30", - "Variation": "20", - "UseShadow": false, - "ConvertToCountPerArea": true, - "Rijbreedte_m": "0.75", //as string - "geometryJson": { - "type": "Polygon", - "coordinates": [ - [ - [ 5.66886041703652044, 52.52929999060298627 ], - [ 5.6716230923214912, 52.52946316399909676 ], - [ 5.67185376229668581, 52.5280565894154563 ], - [ 5.66903207841337231, 52.52790646510525363 ], - [ 5.66886041703652044, 52.52929999060298627 ] - ] - ] - }, - - // if taskmap is not generated, output is only geotiff - "GenerateTaskmap": true, - "CellWidth": "3", - "CellHeight": "10", - "StartPoint": { - "type": "Point", - "coordinates": [ 5.66886041703652044, 52.52929999060298627 ] - }, - "EndPoint": { - "type": "Point", - "coordinates": [ 5.6716230923214912, 52.52946316399909676 ] - } // if no angle - - //"Angle": "317.0" // if no endpoint - } - -] diff --git a/FarmmapsPoten_AVRapi/PotenServiceAVR.cs b/FarmmapsPoten_AVRapi/PotenServiceAVR.cs deleted file mode 100644 index 42ec93e..0000000 --- a/FarmmapsPoten_AVRapi/PotenServiceAVR.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Globalization; -using System.Threading.Tasks; -using FarmmapsApi.Models; -using FarmmapsApi.Services; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using static FarmmapsApi.Extensions; -using static FarmmapsApiSamples.Constants; - - -namespace FarmmapsVRApoten -{ - public class PotenServiceAVR - { - private readonly ILogger _logger; - private readonly FarmmapsApiService _farmmapsApiService; - private readonly GeneralService _generalService; - - public PotenServiceAVR(ILogger logger, FarmmapsApiService farmmapsApiService, - GeneralService generalService) - { - _logger = logger; - _farmmapsApiService = farmmapsApiService; - _generalService = generalService; - } - - public async Task CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation) - { - var potenApplicationMapRequest = new TaskRequest() { TaskType = VRAPLANTING_TASK }; - if (inputItem != null) { potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; } - potenApplicationMapRequest.attributes["meanDensity"] = meanDensity; - potenApplicationMapRequest.attributes["variation"] = variation; - - var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest); - _logger.LogInformation($"itemTaskCode: {taskCode}"); - _logger.LogInformation($"potenTaskmapRequest: {potenApplicationMapRequest}"); - _logger.LogInformation($"potenTaskmapRequest type: {potenApplicationMapRequest.TaskType}"); - _logger.LogInformation($"cropfieldItemCode: {cropfieldItem.Code}"); - - - - await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => - { - var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); - _logger.LogInformation($"Waiting on calculation of application map; Status: {itemTaskStatus.State}"); - if (itemTaskStatus.IsFinished) - tokenSource.Cancel(); - }); - - - - var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); - if (itemTask.State == ItemTaskState.Error) - { - _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); - return null; - } - - var itemName = $"VRAPoten"; - var applianceMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code, - GEOTIFF_PROCESSED_ITEMTYPE, itemName, - i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) && - i.Name.ToLower().Contains(itemName.ToLower())); - - if (applianceMapItem == null) - { - _logger.LogError("Could not find the VRAPoten geotiff child item under cropfield"); - return null; - } - - return applianceMapItem; - - } - - - // Extra task making use of the zonering task to convert the planting distance in cm to number of seeds per m2 !!! mind the hardcoded values !!! - public async Task ConvertToCountPerAreaTroughZonering(Item cropfieldItem, Item geotiffItem, string rijBreedte_m) - { - var zoneringTaskRequest = new TaskRequest() { TaskType = VRAZONERING_TASK }; - zoneringTaskRequest.attributes["formula"] = $"((100/[0])/{rijBreedte_m})"; - zoneringTaskRequest.attributes["output"] = "{\"Name\":\"CountPerAreaConversion\",\"Quantity\":\"CountPerArea\",\"Unit\":\"#/m2\"}"; - zoneringTaskRequest.attributes["inputs"] = $"[{{\"ItemCode\":\"{geotiffItem.Code}\",\"LayerName\":\"Appliancemap\"}}]"; - - var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, zoneringTaskRequest); - - await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => - { - var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); - _logger.LogInformation($"Waiting on convertion to Count per area through zoneringTast; Status: {itemTaskStatus.State}"); - if (itemTaskStatus.IsFinished) - tokenSource.Cancel(); - }); - - var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); - if (itemTask.State == ItemTaskState.Error) - { - _logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); - return null; - } - - var applianceMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code, - GEOTIFF_PROCESSED_ITEMTYPE, "CountPerAreaConversion", - i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) && - i.Name.ToLower().Contains("CountPerAreaConversion".ToLower())); - - if (applianceMapItem == null) - { - _logger.LogError("Could not find the converted to count per area geotiff child item under cropfield"); - return null; - } - - return applianceMapItem; - } - - - } -} - - diff --git a/FarmmapsPoten_AVRapi/appsettings.json b/FarmmapsPoten_AVRapi/appsettings.json deleted file mode 100644 index 3e75982..0000000 --- a/FarmmapsPoten_AVRapi/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Authority": "https://accounts.test.farmmaps.eu/", - "Endpoint": "https://test.farmmaps.eu/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": [ "api" ] -} \ No newline at end of file