Merge pull request 'Veranderingen jits, fedde en pepijn.' (#9) from jits/FarmMapsApiClient_WURtest:master into master

Reviewed-on: #9
This commit is contained in:
Mark van der Wal 2021-06-10 08:25:24 +00:00
commit 61985f9079
56 changed files with 3072 additions and 1243 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
bin/ bin/
obj/ obj/
appsettings.secrets.json appsettings.secrets.json
FarmmapsBulkSatDownload/DBsettings.secrets.json

View File

@ -74,8 +74,8 @@ namespace FarmMapsBlight
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
} }
DateTime adviceDate = DateTime.Now.Date; DateTime adviceDate = new DateTime(2020, 7, 7);// DateTime.Now.Date;
DateTime plantingDate = new DateTime(2020, 3, 20); DateTime plantingDate = new DateTime(2020, 4, 20);
DateTime emergeDate = new DateTime(2020, 5, 20); DateTime emergeDate = new DateTime(2020, 5, 20);
var blightItem = await _blightService.CreateAdvice(cropfieldItem, adviceDate, plantingDate, emergeDate); var blightItem = await _blightService.CreateAdvice(cropfieldItem, adviceDate, plantingDate, emergeDate);

View File

@ -32,7 +32,7 @@ namespace FarmMapsBlight
TaskType = "vnd.farmmaps.task.blight" TaskType = "vnd.farmmaps.task.blight"
}; };
taskRequest.attributes["d"] = DateTime.Now.Date.ToString("o"); taskRequest.attributes["d"] = adviceDate.ToUniversalTime().ToString("o");
taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o"); taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o");
taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o"); taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o");
@ -52,8 +52,8 @@ namespace FarmMapsBlight
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest); var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest);
await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) =>
{ {
_logger.LogInformation("Checking blight task status");
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode);
_logger.LogInformation($"Checking blight task status: { itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
tokenSource.Cancel(); tokenSource.Cancel();
}); });

View File

@ -8,6 +8,7 @@ namespace FarmmapsApiSamples
public const string GEOTIFF_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.geotiff.processed"; public const string GEOTIFF_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.geotiff.processed";
public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield"; public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield";
public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed"; public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed";
public const string ISOXML_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.iso11783.taskdata.processed";
public const string SHAPE_ITEMTYPE = "vnd.farmmaps.itemtype.shape"; public const string SHAPE_ITEMTYPE = "vnd.farmmaps.itemtype.shape";
public const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson"; public const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson";
public const string BLIGHT_ITEMTYPE = "vnd.farmmaps.itemtype.blight"; public const string BLIGHT_ITEMTYPE = "vnd.farmmaps.itemtype.blight";
@ -18,10 +19,12 @@ namespace FarmmapsApiSamples
public const string VRAPLANTING_TASK = "vnd.farmmaps.task.vrapoten"; public const string VRAPLANTING_TASK = "vnd.farmmaps.task.vrapoten";
public const string VRAZONERING_TASK = "vnd.farmmaps.task.vrazonering"; public const string VRAZONERING_TASK = "vnd.farmmaps.task.vrazonering";
public const string SATELLITE_TASK = "vnd.farmmaps.task.satellite"; public const string SATELLITE_TASK = "vnd.farmmaps.task.satellite";
public const string VANDERSAT_TASK = "vnd.farmmaps.task.vandersat";
public const string TASKMAP_TASK = "vnd.farmmaps.task.taskmap"; public const string TASKMAP_TASK = "vnd.farmmaps.task.taskmap";
public const string WORKFLOW_TASK = "vnd.farmmaps.task.workflow"; public const string WORKFLOW_TASK = "vnd.farmmaps.task.workflow";
public const string BOFEK_TASK = "vnd.farmmaps.task.bofek"; public const string BOFEK_TASK = "vnd.farmmaps.task.bofek";
public const string SHADOW_TASK = "vnd.farmmaps.task.shadow"; public const string SHADOW_TASK = "vnd.farmmaps.task.shadow";
public const string AHN_TASK = "vnd.farmmaps.task.ahn"; public const string AHN_TASK = "vnd.farmmaps.task.ahn";
public const string WATBAL_TASK = "vnd.farmmaps.task.watbal";
} }
} }

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace FarmmapsApi.Models
{
public class SatelliteStatistics
{
public string fieldName;
public DateTime satelliteDate;
public string satelliteBand;
public double max;
public double min;
public double mean;
public double mode;
public double median;
public double stddev;
public double minPlus;
public double curtosis;
public double maxMinus;
public double skewness;
public double variance;
public int populationCount;
public double variationCoefficient;
public double confidenceIntervalLow;
public double confidenceIntervalHigh;
public double confidenceIntervalErrorMargin;
}
}

View File

@ -6,29 +6,26 @@ using System.Threading.Tasks;
using FarmmapsApi.Models; using FarmmapsApi.Models;
using Google.Apis.Upload; using Google.Apis.Upload;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using static FarmmapsApi.Extensions; using static FarmmapsApi.Extensions;
using static FarmmapsApiSamples.Constants; using static FarmmapsApiSamples.Constants;
namespace FarmmapsApi.Services namespace FarmmapsApi.Services
{ {
public class GeneralService public class GeneralService {
{
private readonly ILogger<GeneralService> _logger; private readonly ILogger<GeneralService> _logger;
private readonly FarmmapsApiService _farmmapsApiService; private readonly FarmmapsApiService _farmmapsApiService;
public GeneralService(ILogger<GeneralService> logger, FarmmapsApiService farmmapsApiService) public GeneralService(ILogger<GeneralService> logger, FarmmapsApiService farmmapsApiService) {
{
_logger = logger; _logger = logger;
_farmmapsApiService = farmmapsApiService; _farmmapsApiService = farmmapsApiService;
} }
public async Task<Item> CreateCropfieldItemAsync(string parentItemCode, string name, int year, public async Task<Item> CreateCropfieldItemAsync(string parentItemCode, string name, int year,
string fieldGeomJson, string data = "{}") string fieldGeomJson, string data = "{}") {
{
var currentYear = new DateTime(year, 1, 1); var currentYear = new DateTime(year, 1, 1);
var cropfieldItemRequest = new ItemRequest() var cropfieldItemRequest = new ItemRequest() {
{
ParentCode = parentItemCode, ParentCode = parentItemCode,
ItemType = CROPFIELD_ITEMTYPE, ItemType = CROPFIELD_ITEMTYPE,
Name = name, Name = name,
@ -66,7 +63,7 @@ namespace FarmmapsApi.Services
return await FindChildItemAsync(root.Code, SHAPE_PROCESSED_ITEMTYPE, itemName, return await FindChildItemAsync(root.Code, SHAPE_PROCESSED_ITEMTYPE, itemName,
i => i.Created >= startUpload && i => i.Created >= startUpload &&
i.Name.ToLower().Contains(itemName.ToLower()));; i.Name.ToLower().Contains(itemName.ToLower())); ;
} }
public async Task<Item> ShapeToGeotiff(Item shapeItem) public async Task<Item> ShapeToGeotiff(Item shapeItem)
@ -89,8 +86,7 @@ namespace FarmmapsApi.Services
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(tiffItem.Code, taskmapRequest); string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(tiffItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
{
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(tiffItem.Code, itemTaskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(tiffItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on converting geotiff to shape; status: {itemTaskStatus.State}"); _logger.LogInformation($"Waiting on converting geotiff to shape; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
@ -98,6 +94,64 @@ namespace FarmmapsApi.Services
}); });
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(tiffItem.Code, itemTaskCode); var itemTask = await _farmmapsApiService.GetTaskStatusAsync(tiffItem.Code, itemTaskCode);
if (itemTask.State == ItemTaskState.Error) {
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
return null;
}
//the taskmap is a child of the input tiff *** Update feb 2021: it is a child of the cropfield.
var itemName = "Taskmap";
var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
SHAPE_PROCESSED_ITEMTYPE, itemName);
if (taskMapItem == null) {
_logger.LogError("Could not find the shape taskmap as a child item under the input");
return null;
}
return taskMapItem;
}
// Create taskmap based on width, height and direction
public async Task<Item> 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 precision = null,
string cropTypeName = null, string costumerName = null, string ProductGroupName = null, string productName = null,
string resolution = "3", string unitScale = null, string maximumClasses = null)
{
var taskmapRequest = new TaskRequest { TaskType = TASKMAP_TASK };
taskmapRequest.attributes["inputCode"] = tiffItem.Code;
taskmapRequest.attributes["operation"] = outputType; // Currently onlye "shape" supported, if ISOXML is supported this should be an input
taskmapRequest.attributes["cellWidth"] = cellWidth; //metres
taskmapRequest.attributes["cellHeight"] = cellHeight; //metres
taskmapRequest.attributes["startPoint"] = startPoint; // Coordinates WGS84
taskmapRequest.attributes["centered"] = centered;
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
// 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;
if (productName != null) taskmapRequest.attributes["productName"] = productName;
if (resolution != null) taskmapRequest.attributes["resolution"] = resolution;
if (unitScale != null) taskmapRequest.attributes["unitScale"] = unitScale;
if (maximumClasses != null) taskmapRequest.attributes["maximumClasses"] = maximumClasses; // Can be used for shapefile too
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on conversion to Taskmap; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished)
tokenSource.Cancel();
});
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
if (itemTask.State == ItemTaskState.Error) if (itemTask.State == ItemTaskState.Error)
{ {
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); _logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
@ -106,11 +160,25 @@ namespace FarmmapsApi.Services
//the taskmap is a child of the input tiff //the taskmap is a child of the input tiff
var itemName = "Taskmap"; var itemName = "Taskmap";
var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode, Item taskMapItem = null;
SHAPE_PROCESSED_ITEMTYPE, itemName); if (outputType == "isoxml") {taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
ISOXML_PROCESSED_ITEMTYPE, itemName);
}
else if (outputType== "shape") {
taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
SHAPE_PROCESSED_ITEMTYPE, outputType);
}
else
{
_logger.LogError("OutputType not specified, could not determine if output should be shape or ISOXML");
taskMapItem = null;
}
if (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 cropfield");
return null; return null;
} }
@ -119,18 +187,15 @@ namespace FarmmapsApi.Services
public async Task<ItemTaskStatus> RunAndWaitForTask(Item subjectItem, string taskIdentifier, public async Task<ItemTaskStatus> RunAndWaitForTask(Item subjectItem, string taskIdentifier,
Action<TaskRequest> configureCallback = null, int retrySeconds = 3) Action<TaskRequest> configureCallback = null, int retrySeconds = 3) {
{ var taskRequest = new TaskRequest() {
var taskRequest = new TaskRequest()
{
TaskType = taskIdentifier TaskType = taskIdentifier
}; };
configureCallback?.Invoke(taskRequest); configureCallback?.Invoke(taskRequest);
var taskCode = await _farmmapsApiService.QueueTaskAsync(subjectItem.Code, taskRequest); var taskCode = await _farmmapsApiService.QueueTaskAsync(subjectItem.Code, taskRequest);
await PollTask(TimeSpan.FromSeconds(retrySeconds), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(retrySeconds), async (tokenSource) => {
{
_logger.LogInformation($"Checking {taskIdentifier} task status"); _logger.LogInformation($"Checking {taskIdentifier} task status");
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(subjectItem.Code, taskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(subjectItem.Code, taskCode);
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
@ -143,26 +208,22 @@ namespace FarmmapsApi.Services
} }
public async Task<Item> FindChildItemAsync(string parentCode, string itemType, string containsName, public async Task<Item> FindChildItemAsync(string parentCode, string itemType, string containsName,
Func<Item, bool> filter = null, int maxTries = 10) Func<Item, bool> filter = null, int maxTries = 10) {
{
Item dataItem = null; Item dataItem = null;
int tries = 0; int tries = 0;
await PollTask(TimeSpan.FromSeconds(3), async source => await PollTask(TimeSpan.FromSeconds(3), async source => {
{
_logger.LogInformation($"Trying to get {containsName} data"); _logger.LogInformation($"Trying to get {containsName} data");
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType); var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(parentCode, itemType);
Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower())); Func<Item, bool> func = filter ?? (i => i.Name.ToLower().Contains(containsName.ToLower()));
dataItem = uploadedFilesChildren.FirstOrDefault(func); dataItem = uploadedFilesChildren.FirstOrDefault(func);
if (dataItem != null || tries == maxTries) if (dataItem != null || tries == maxTries) {
{
source.Cancel(); source.Cancel();
} }
tries++; tries++;
}); });
if (dataItem == null) if (dataItem == null) {
{
_logger.LogError("dataItem not found"); _logger.LogError("dataItem not found");
return null; return null;
} }
@ -171,14 +232,12 @@ namespace FarmmapsApi.Services
return dataItem; return dataItem;
} }
public async Task<Item> RunBofekTask(Item cropfieldItem) public async Task<Item> RunBofekTask(Item cropfieldItem) {
{ var taskmapRequest = new TaskRequest { TaskType = BOFEK_TASK };
var taskmapRequest = new TaskRequest {TaskType = BOFEK_TASK};
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest); string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
{
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on retreiving BOFEK data; status: {itemTaskStatus.State}"); _logger.LogInformation($"Waiting on retreiving BOFEK data; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
@ -186,8 +245,7 @@ namespace FarmmapsApi.Services
}); });
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
if (itemTask.State == ItemTaskState.Error) if (itemTask.State == ItemTaskState.Error) {
{
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); _logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
return null; return null;
} }
@ -196,8 +254,7 @@ namespace FarmmapsApi.Services
var itemName = "bofek"; var itemName = "bofek";
var bofekItem = await FindChildItemAsync(cropfieldItem.Code, var bofekItem = await FindChildItemAsync(cropfieldItem.Code,
SHAPE_PROCESSED_ITEMTYPE, itemName); SHAPE_PROCESSED_ITEMTYPE, itemName);
if (bofekItem == null) if (bofekItem == null) {
{
_logger.LogError("Could not find the BOFEK data as a child item under the cropfield"); _logger.LogError("Could not find the BOFEK data as a child item under the cropfield");
return null; return null;
} }
@ -205,14 +262,12 @@ namespace FarmmapsApi.Services
return bofekItem; return bofekItem;
} }
public async Task<Item> RunAhnTask(Item cropfieldItem) public async Task<Item> RunAhnTask(Item cropfieldItem) {
{ var taskmapRequest = new TaskRequest { TaskType = AHN_TASK };
var taskmapRequest = new TaskRequest {TaskType = AHN_TASK};
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest); string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
{
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on retreiving AHN data; status: {itemTaskStatus.State}"); _logger.LogInformation($"Waiting on retreiving AHN data; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
@ -220,8 +275,7 @@ namespace FarmmapsApi.Services
}); });
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
if (itemTask.State == ItemTaskState.Error) if (itemTask.State == ItemTaskState.Error) {
{
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); _logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
return null; return null;
} }
@ -230,8 +284,7 @@ namespace FarmmapsApi.Services
var itemName = "ahn"; var itemName = "ahn";
var ahnItem = await FindChildItemAsync(cropfieldItem.Code, var ahnItem = await FindChildItemAsync(cropfieldItem.Code,
GEOTIFF_PROCESSED_ITEMTYPE, itemName); GEOTIFF_PROCESSED_ITEMTYPE, itemName);
if (ahnItem == null) if (ahnItem == null) {
{
_logger.LogError("Could not find the AHN data as a child item under the cropfield"); _logger.LogError("Could not find the AHN data as a child item under the cropfield");
return null; return null;
} }
@ -239,14 +292,12 @@ namespace FarmmapsApi.Services
return ahnItem; return ahnItem;
} }
public async Task<Item> RunShadowTask(Item cropfieldItem) public async Task<Item> RunShadowTask(Item cropfieldItem) {
{ var taskmapRequest = new TaskRequest { TaskType = SHADOW_TASK };
var taskmapRequest = new TaskRequest {TaskType = SHADOW_TASK};
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest); string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
{
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on calculation shadow data; status: {itemTaskStatus.State}"); _logger.LogInformation($"Waiting on calculation shadow data; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
@ -254,8 +305,7 @@ namespace FarmmapsApi.Services
}); });
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
if (itemTask.State == ItemTaskState.Error) if (itemTask.State == ItemTaskState.Error) {
{
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); _logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
return null; return null;
} }
@ -264,13 +314,359 @@ namespace FarmmapsApi.Services
var itemName = "shadow"; var itemName = "shadow";
var shadowItem = await FindChildItemAsync(cropfieldItem.Code, var shadowItem = await FindChildItemAsync(cropfieldItem.Code,
GEOTIFF_PROCESSED_ITEMTYPE, itemName); GEOTIFF_PROCESSED_ITEMTYPE, itemName);
if (shadowItem == null) if (shadowItem == null) {
{
_logger.LogError("Could not find the shadow data as a child item under the cropfield"); _logger.LogError("Could not find the shadow data as a child item under the cropfield");
return null; return null;
} }
return shadowItem; return shadowItem;
} }
public async Task<string> RunSatelliteTask(Item cropfieldItem) {
_logger.LogInformation("Gathering satellite information for cropfield, this might take a while!");
var taskmapRequest = new TaskRequest { TaskType = SATELLITE_TASK };
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on satellite data; 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 when trying to process satellite data; {itemTask.Message}");
}
return itemTask.Code;
}
public async Task<Item> FindSatelliteItem(Item cropfieldItem, string satelliteTaskCode) {
var taskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, satelliteTaskCode);
var temporalItem = await FindChildItemAsync(cropfieldItem.Code, TEMPORAL_ITEMTYPE,
"Cropfield Satellite items", item => item.SourceTask == SATELLITE_TASK &&
taskStatus.Finished >= item.Created &&
taskStatus.Finished <= item.Created.Value.AddHours(1));
if (temporalItem == null) {
_logger.LogError("Temporal item not found");
}
var satelliteTiffs = await _farmmapsApiService.GetItemChildrenAsync(temporalItem.Code);
_logger.LogInformation("Available satellite images:");
var count = 0;
TimeSpan.FromSeconds(0.5);
foreach (var item in satelliteTiffs) {
Console.WriteLine($"Satellite image #{count}: {item.DataDate}");
count++;
}
_logger.LogInformation("Enter satellite image number for NBS application");
int element = Int32.Parse(Console.ReadLine());
var selectedSatelliteItem = satelliteTiffs[element];
if (selectedSatelliteItem == null)
{
_logger.LogError("Satellite item not found");
}
return selectedSatelliteItem;
}
public async Task<List<Item>> FindSatelliteItems(Item cropfieldItem, string satelliteTaskCode)
{
var taskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, satelliteTaskCode);
if (taskStatus.State == ItemTaskState.Error)
{
_logger.LogWarning(taskStatus.Message);
return null;
}
else
{
// find satellite data geotiffs
var temporalItem = await FindChildItemAsync(cropfieldItem.Code, TEMPORAL_ITEMTYPE,
"Cropfield Satellite items", item => item.SourceTask == SATELLITE_TASK &&
taskStatus.Finished >= item.Created &&
taskStatus.Finished <= item.Created.Value.AddHours(1));
if (temporalItem == null)
{
_logger.LogWarning("Temporal item not found");
return null;
}
else
{
var satelliteTiffs = await _farmmapsApiService.GetItemChildrenAsync(temporalItem.Code);
return satelliteTiffs;
}
}
}
public async Task<string> DownloadSatelliteStats(List<Item> satelliteTiffs, string fieldName = null, List<string> satelliteBands = null, string downloadFolder = null)
{
string satelliteDataStatisticsFile = Path.Combine(downloadFolder, $"satelliteStats_{fieldName}.csv");
File.Delete(satelliteDataStatisticsFile); // Delete the SatelliteFile file if exists
string headerLineStats = $"FieldName,satelliteDate,satelliteBand,max,min,mean,mode,median,stddev,minPlus,curtosis,maxMinus,skewness,variance,populationCount,variationCoefficient,confidenceIntervalLow, confidenceIntervalHigh,confidenceIntervalErrorMargin" + Environment.NewLine;
File.AppendAllText(satelliteDataStatisticsFile, headerLineStats);
foreach (var satelliteTiff in satelliteTiffs)
{
List<JToken> layers = satelliteTiff.Data["layers"].Children().ToList();
foreach (JToken layer in layers)
{
DateTime satelliteImageDate = (DateTime)satelliteTiff.DataDate;
string satelliteBand = layer["name"].ToString();
if (satelliteBands.Contains(satelliteBand))
{
JToken satelliteStatisticsJtoken = layer["renderer"]["band"]["statistics"];
if (satelliteStatisticsJtoken == null)
{
_logger.LogWarning($"{satelliteImageDate.ToString("yyyy-MM-dd")} no statistics found for satelliteBand '{satelliteBand}'");
}
else
{
SatelliteStatistics satelliteStatistics = satelliteStatisticsJtoken.ToObject<SatelliteStatistics>();
satelliteStatistics.fieldName = fieldName;
satelliteStatistics.satelliteDate = satelliteImageDate;
satelliteStatistics.satelliteBand = satelliteBand;
File.AppendAllText(satelliteDataStatisticsFile, $"" +
$"{satelliteStatistics.fieldName}," +
$"{satelliteStatistics.satelliteDate.ToString("yyyy-MM-dd")}," +
$"{satelliteStatistics.satelliteBand}," +
$"{satelliteStatistics.max}," +
$"{satelliteStatistics.min}," +
$"{satelliteStatistics.mean}," +
$"{satelliteStatistics.mode}," +
$"{satelliteStatistics.median}," +
$"{satelliteStatistics.stddev}," +
$"{satelliteStatistics.minPlus}," +
$"{satelliteStatistics.curtosis}," +
$"{satelliteStatistics.maxMinus}," +
$"{satelliteStatistics.skewness}," +
$"{satelliteStatistics.variance}," +
$"{satelliteStatistics.populationCount}," +
$"{satelliteStatistics.variationCoefficient}," +
$"{satelliteStatistics.confidenceIntervalLow}," +
$"{satelliteStatistics.confidenceIntervalHigh}," +
$"{satelliteStatistics.confidenceIntervalErrorMargin}" +
Environment.NewLine);
}
}
}
}
return satelliteDataStatisticsFile;
}
public async Task<List<SatelliteStatistics>> ListSatelliteStatistics(Item satelliteTiff, List<string> satelliteBands = null, string fieldName = null)
{
SatelliteStatistics satelliteStatistics;
List<SatelliteStatistics> listSatelliteStatistics = new List<SatelliteStatistics>();
List<JToken> layers = satelliteTiff.Data["layers"].Children().ToList();
foreach (JToken layer in layers)
{
DateTime satelliteImageDate = (DateTime)satelliteTiff.DataDate;
string satelliteBand = layer["name"].ToString();
//_logger.LogInformation($"Date '{satelliteImageDate.ToString("yyyy-MM-dd")}': satelliteBand: {satelliteBand}");
if (satelliteBands.Contains(satelliteBand))
{
JToken satelliteStatisticsJtoken = layer["renderer"]["band"]["statistics"];
if (satelliteStatisticsJtoken == null)
{
_logger.LogWarning($"{satelliteImageDate.ToString("yyyy-MM-dd")} no statistics found for satelliteBand '{satelliteBand}'");
//Console.WriteLine($"Available data: {item.Data}");
}
else
{
//_logger.LogInformation($"Adding satelliteStatistics to listSatelliteStatistics");
satelliteStatistics = satelliteStatisticsJtoken.ToObject<SatelliteStatistics>();
satelliteStatistics.fieldName = fieldName;
satelliteStatistics.satelliteDate = satelliteImageDate;
satelliteStatistics.satelliteBand = satelliteBand;
listSatelliteStatistics.Add(satelliteStatistics);
}
}
//else
//{
// _logger.LogInformation($"this satelliteBand is not in your list satelliteBands");
//}
}
return listSatelliteStatistics;
}
//VanDerSat
public async Task<string> RunVanDerSatTask(Item cropfieldItem) {
_logger.LogInformation("Gathering VanDerSat information for cropfield, this might take a while!");
var taskmapRequest = new TaskRequest { TaskType = VANDERSAT_TASK };
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on VanDerSat data; 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 when trying to process VanDerSat data; {itemTask.Message}");
}
return itemTask.Code;
}
public async Task<Item> FindVanDerSatItem(Item cropfieldItem, string VanDerSatTaskCode, string FieldName, bool StoreStatistics) {
var taskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, VanDerSatTaskCode);
// find VanDerSat data temporal
var temporalItem = await FindChildItemAsync(cropfieldItem.Code, TEMPORAL_ITEMTYPE, "Van der Sat");
if (temporalItem == null) {
_logger.LogError("Temporal item not found");
}
var VanDerSatiffs = await _farmmapsApiService.GetItemChildrenAsync(temporalItem.Code);
_logger.LogInformation("Available VanDerSat images:");
var count = 0;
TimeSpan.FromSeconds(0.5);
foreach (var item in VanDerSatiffs) {
//Console.WriteLine($"Van der Sat image #{count}: {item.DataDate}");
//if (count == 0 ) {
// Console.WriteLine($"vandersat image #{count}: {item.Data}");
//}
if (StoreStatistics == true) {
var VanDerSatBand = item.Data["layers"][0]["name"];
var VanderSatFile = $"C:\\Akkerweb\\{FieldName}_{VanDerSatBand}.csv";
var NewLineField = $"Field,Date,Mean,Min,Max,Standard deviation, ConfidenceInterval low, ConfidenceInterval high" + Environment.NewLine;
if (count == 0) {
File.AppendAllText(VanderSatFile, NewLineField);
var numbervandersat = VanDerSatiffs.Count;
Console.WriteLine($"{numbervandersat} Van der Sat images found");
}
var VanderSatStatistics = item.Data["layers"][0]["renderer"]["band"]["statistics"];
var VanDerSatImageDate = (DateTime)item.DataDate;
var VanderSatDate = VanDerSatImageDate.ToString("yyyy-MM-dd");
var NewLineDate = $"\"date\":{VanderSatDate}" + Environment.NewLine;
if (VanderSatStatistics == null) {
Console.WriteLine($"{VanderSatDate} no statistics found");
//Console.WriteLine($"Available data: {item.Data}");
} else {
File.AppendAllText(VanderSatFile, $"{FieldName},{VanderSatDate},{VanderSatStatistics["mean"]},{VanderSatStatistics["min"]},{VanderSatStatistics["max"]},{VanderSatStatistics["stddev"]},{VanderSatStatistics["confidenceIntervalLow"]},{VanderSatStatistics["confidenceIntervalHigh"]}" + Environment.NewLine);
}
}
count++;
}
//_logger.LogInformation("Enter VanDerSat image number");
//int element = Int32.Parse(Console.ReadLine());
int element = 0;
var selectedVanDerSatItem = VanDerSatiffs[element];
if (selectedVanDerSatItem == null) {
_logger.LogError("VanDerSat item not found");
}
return selectedVanDerSatItem;
}
public async Task<string> RunWatBalTask(Item cropfieldItem) {
_logger.LogInformation("Gathering WatBal information for cropfield, this might take a while!");
var taskmapRequest = new TaskRequest { TaskType = WATBAL_TASK };
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Waiting on VanDerSat data; 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 when trying to process WatBal data; {itemTask.Message}");
}
return itemTask.Code;
}
public async Task<Item> FindWatBalItem(Item cropfieldItem, string WatBalTaskCode, string FieldName, bool StoreStatistics) {
var taskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, WatBalTaskCode);
// find WatBal data temporal
var temporalItem = await FindChildItemAsync(cropfieldItem.Code, TEMPORAL_ITEMTYPE, "Watbal",
item => item.SourceTask == WATBAL_TASK && taskStatus.Finished >= item.Created && taskStatus.Finished <= item.Created.Value.AddHours(1));
if (temporalItem == null) {
_logger.LogError("Temporal item not found");
}
var WatBalData = await _farmmapsApiService.GetItemChildrenAsync(temporalItem.Code);
_logger.LogInformation("Available WatBal Data:");
var count = 0;
TimeSpan.FromSeconds(0.5);
foreach (var item in WatBalData) {
Console.WriteLine($"WatBal data #{count}: {item.DataDate}");
if (count == 0) {
Console.WriteLine($"WatBalData #{count}: {item.Data}");
}
count++;
}
int element = 0;
var selectedWatBalItem = WatBalData[element];
if (selectedWatBalItem == null) {
_logger.LogError("WatBal item not found");
}
return selectedWatBalItem;
}
} }
} }

View File

@ -19,11 +19,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsHaulmkilling", "Far
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsPoten", "FarmmapsPoten\FarmmapsPoten.csproj", "{AAFAB03A-6F5C-4D91-991F-867B7898F981}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsPoten", "FarmmapsPoten\FarmmapsPoten.csproj", "{AAFAB03A-6F5C-4D91-991F-867B7898F981}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmMapsBlight", "FarmMapsBlight\FarmMapsBlight.csproj", "{892E0932-5D11-4A37-979E-CEDB39C2E181}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmMapsBlight", "FarmMapsBlight\FarmMapsBlight.csproj", "{892E0932-5D11-4A37-979E-CEDB39C2E181}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmmapsZonering", "FarmmapsZonering\FarmmapsZonering.csproj", "{91A58C4A-4A80-4079-B43D-9B851206194F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsZonering", "FarmmapsZonering\FarmmapsZonering.csproj", "{91A58C4A-4A80-4079-B43D-9B851206194F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Secrets", "Secrets\Secrets.csproj", "{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsDataDownload", "FarmmapsDataDownload\FarmmapsDataDownload.csproj", "{32ED9500-AAAB-4030-9C7A-F611A85DF890}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsBulkSatDownload", "FarmmapsBulkSatDownload\FarmmapsBulkSatDownload.csproj", "{772DBDCD-9FAA-40A7-8551-2C1620C4AB67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Secrets", "Secrets\Secrets.csproj", "{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FarmmapsCleanUp", "FarmmapsCleanUp\FarmmapsCleanUp.csproj", "{5E4387F9-5953-4A9B-BCA5-DF3964EED3CB}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -59,10 +65,22 @@ Global
{91A58C4A-4A80-4079-B43D-9B851206194F}.Debug|Any CPU.Build.0 = Debug|Any CPU {91A58C4A-4A80-4079-B43D-9B851206194F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91A58C4A-4A80-4079-B43D-9B851206194F}.Release|Any CPU.ActiveCfg = Release|Any CPU {91A58C4A-4A80-4079-B43D-9B851206194F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91A58C4A-4A80-4079-B43D-9B851206194F}.Release|Any CPU.Build.0 = Release|Any CPU {91A58C4A-4A80-4079-B43D-9B851206194F}.Release|Any CPU.Build.0 = Release|Any CPU
{32ED9500-AAAB-4030-9C7A-F611A85DF890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32ED9500-AAAB-4030-9C7A-F611A85DF890}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32ED9500-AAAB-4030-9C7A-F611A85DF890}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32ED9500-AAAB-4030-9C7A-F611A85DF890}.Release|Any CPU.Build.0 = Release|Any CPU
{772DBDCD-9FAA-40A7-8551-2C1620C4AB67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{772DBDCD-9FAA-40A7-8551-2C1620C4AB67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{772DBDCD-9FAA-40A7-8551-2C1620C4AB67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{772DBDCD-9FAA-40A7-8551-2C1620C4AB67}.Release|Any CPU.Build.0 = Release|Any CPU
{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Release|Any CPU.Build.0 = Release|Any CPU {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Release|Any CPU.Build.0 = Release|Any CPU
{5E4387F9-5953-4A9B-BCA5-DF3964EED3CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E4387F9-5953-4A9B-BCA5-DF3964EED3CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E4387F9-5953-4A9B-BCA5-DF3964EED3CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E4387F9-5953-4A9B-BCA5-DF3964EED3CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,505 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using FarmmapsApi;
using FarmmapsApi.Models;
using FarmmapsApi.Services;
using FarmmapsBulkSatDownload.Models;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Npgsql;
using Newtonsoft.Json.Linq;
using static FarmmapsApiSamples.Constants;
using System.Text;
namespace FarmmapsBulkSatDownload
{
public class BulkSatDownloadApplication : IApplication
{
private readonly ILogger<BulkSatDownloadApplication> _logger;
private readonly FarmmapsApiService _farmmapsApiService;
private readonly BulkSatDownloadService _bulkSatDownloadService;
private readonly GeneralService _generalService;
public const string settingsfile = "Settings.json";
private Settings _settings;
public BulkSatDownloadApplication(ILogger<BulkSatDownloadApplication> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService, BulkSatDownloadService bulkSatDownloadService)
{
_logger = logger;
_farmmapsApiService = farmmapsApiService;
_generalService = generalService;
_bulkSatDownloadService = bulkSatDownloadService;
}
public async Task RunAsync()
{
// Check if we have permission
// !! 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();
BulkSatDownloadInput bulkSatDownloadInput;
List<BulkSatDownloadInput> bulkSatDownloadInputList;
// Below are two options to for bulk download: (1) from and to database or (2) inputs from json, output to csv
// For illustration we make two lists bulkSatDownloadInputListDB and bulkSatDownloadInputListCsv and then choose which one we will use
List<BulkSatDownloadInput> bulkSatDownloadInputListDB;
List<BulkSatDownloadInput> bulkSatDownloadInputListCsv;
DateTime lastdownloadedimagedate;
int cropYear;
// Option 1: When using database need to (1) fill in database data in DBsettings.secrets.json; (2) write tailor made SELECT query for fieldinputs in following lines;
// (3) Write tailor made INSERT INTO query in Task Process() below;
// Initialize databases. Username, password etc stored in file "DBsettings.secrets.json".
// Crashes if "DBsettings.secrets.json" is absent or empty
DB dbparcels = JsonConvert.DeserializeObject<DB>(File.ReadAllText("DBsettings.secrets.json"));
string schemaname = "bigdata";
string parceltablename = "parcel_bollenrevolutie_tulips2020"; //"parcelsijbrandij" "parcel"; "parcel_flowerbulbs"; "parcel_disac"; ""parcel_bollenrevolutie_tulips2020""
string groenmonitortablename = "groenmonitor_bollenrevolutie_tulips2020"; //"groenmonitorsijbrandij" "groenmonitor" "groenmonitor_flowerbulbs" "groenmonitor_disac" "groenmonitor_bollenrevolutie_tulips2020"
// The view 'groenmonitorlatestviewname' contains per parcelid (arbid) the year in which it "exists" and the date of the latest image downloaded. It is used to prevent unneccessary downloading of image statistics already in the database
string groenmonitorlatestviewname = "groenmonitorlatest_bollenrevolutie_tulips2020"; //"groenmonitorsijbrandijlatest" "groenmonitorlatest" "groenmonitorlatest_flowerbulbs" "groenmonitorlatest_disac" "groenmonitorlatest_bollenrevolutie_tulips2020"
// Database query and connection. Geometry must be in WGS84 coordinate system, EPSG 4326
// Apparently the FarmmapsApi cannot handle MultiPolygon, so we need to convert to single Polygon
// In case database returns a MultiPolygon use ST_NumGeometries(pt.geom) to count the number of polygons
// If necessary use WHERE ST_NumGeometries(pt.geom) = 1 to select only single polygons
//
// FarmMaps get's its satellite images from www.groenmonitor.nl through the https://agrodatacube.wur.nl/.
// Many images are available at www.groenmonitor.nl, the https://agrodatacube.wur.nl/ serves only the clean images, 10-30 per year, 2019 onwards. Possibly more images will be added for earlier years
// For other images contact www.groenmonitor.nl, gerbert.roerink@wur.nl
bulkSatDownloadInputListDB = new List<BulkSatDownloadInput>();
List<string> satelliteBands = new List<string> { "wdvi", "ndvi" };
string connectionString = dbparcels.GetConnectionString();
string readSql = string.Format(
@"
SELECT pt.arbid, pt.year, gml.lastwenrdate, ST_AsGeoJSON(ST_Transform((ST_DUMP(pt.geom)).geom::geometry(Polygon),4326)) AS geojson_polygon_wgs84,
COALESCE(pt.cropfielditemcode,'') AS cropfielditemcode,
CASE WHEN pt.year >= DATE_PART('year', CURRENT_DATE) THEN '' ELSE COALESCE(pt.satellitetaskcode,'') END AS satellitetaskcode
FROM {0}.{1} pt, {0}.{2} gml
WHERE
pt.arbid = gml.arbid
AND pt.satellitetaskcode IS NULL
ORDER BY pt.arbid
LIMIT 5;", schemaname, parceltablename, groenmonitorlatestviewname); //LIMIT x for testing
using (NpgsqlConnection connection = new NpgsqlConnection(connectionString))
{
connection.Open();
// Read data (run query) = build a list of fields for which to download images
NpgsqlCommand command = connection.CreateCommand();
command.CommandText = readSql;
NpgsqlDataReader dr = command.ExecuteReader();
while (dr.Read())
{
bulkSatDownloadInput = new BulkSatDownloadInput();
bulkSatDownloadInput.fieldID = dr.GetInt16(0);
bulkSatDownloadInput.fieldName = string.Format($"{parceltablename}_{bulkSatDownloadInput.fieldID}");
bulkSatDownloadInput.cropYear = dr.GetInt16(1); ;
bulkSatDownloadInput.lastdownloadedimagedate = dr.GetDateTime(2);
bulkSatDownloadInput.GeometryJson = JObject.Parse(dr.GetString(3));
bulkSatDownloadInput.SatelliteBands = satelliteBands;
bulkSatDownloadInput.cropfielditemcode = dr.GetString(4);
bulkSatDownloadInput.satellitetaskcode = dr.GetString(5);
bulkSatDownloadInput.database = dbparcels;
bulkSatDownloadInput.schemaname = schemaname;
bulkSatDownloadInput.cropfieldtable = parceltablename;
bulkSatDownloadInput.satelllitetable = groenmonitortablename;
bulkSatDownloadInputListDB.Add(bulkSatDownloadInput);
}
connection.Close();
}
// Option 2: Example without database. Comment out this part if you want to use database
// Read cropfields "BulkSatDownloadInput.json" and write all stats to a single csv file
// Write all stats for multiple fields will be written to a single csv file
//string downloadFolder;
//string fileNameStats;
//string headerLineStats = $"FieldName,satelliteDate,satelliteBand,max,min,mean,mode,median,stddev,minPlus,curtosis,maxMinus,skewness,variance,populationCount,variationCoefficient,confidenceIntervalLow, confidenceIntervalHigh,confidenceIntervalErrorMargin" + Environment.NewLine;
//var fieldsInputJson = File.ReadAllText("BulkSatDownloadInput.json");
//bulkSatDownloadInputListCsv = JsonConvert.DeserializeObject<List<BulkSatDownloadInput>>(fieldsInputJson);
//for (int i = 0; i < bulkSatDownloadInputListCsv.Count; i++)
//{
// downloadFolder = bulkSatDownloadInputListCsv[i].downloadFolder;
// fileNameStats = Path.Combine(downloadFolder, bulkSatDownloadInputListCsv[i].fileNameStats);
// if (!Directory.Exists(downloadFolder))
// Directory.CreateDirectory(downloadFolder);
// bulkSatDownloadInputListCsv[i].fileNameStats = fileNameStats;
// // Header same as in GeneralService.DownloadSatelliteStats
// // Delete fileNameStats if existing. Create a new file. Add a header to csv file
// File.Delete(fileNameStats);
// File.AppendAllText(fileNameStats, headerLineStats);
//}
// Now choose which list you want to use
bulkSatDownloadInputList = bulkSatDownloadInputListDB; //bulkSatDownloadInputListDB; //bulkSatDownloadInputListCsv;
// Whichever option (database or json/csv), continue here
// Delete the settingsfile
// File.Delete(settingsfile);
// For each input download all images. Keep track to time, important when doing bulk downloads
var watch = System.Diagnostics.Stopwatch.StartNew();
TimeSpan tsSofar = new TimeSpan();
TimeSpan tsRemaining;
TimeSpan tsTotalEstimated;
for (int i = 0; i < bulkSatDownloadInputList.Count; i++)
{
watch.Restart();
bulkSatDownloadInput = bulkSatDownloadInputList[i];
if (string.IsNullOrEmpty(bulkSatDownloadInput.fileNameStats) == false) _logger.LogInformation(string.Format($"// FarmmapsBulkSatDownload: Downloading stats for field {i+1} out of {bulkSatDownloadInputList.Count} to single csv file {bulkSatDownloadInput.fileNameStats}"));
if (bulkSatDownloadInput.database != null) _logger.LogInformation(string.Format($"// FarmmapsBulkSatDownload: Downloading stats for field {i+1} out of {bulkSatDownloadInputList.Count} to database {bulkSatDownloadInput.schemaname}.{bulkSatDownloadInput.satelllitetable}"));
try
{
await Process(roots, bulkSatDownloadInput);
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
}
watch.Stop();
// add this downloadtime to the cropfieldtable.
// Only if cropfieldtable has a field called 'downloadtime' type 'time'!
//using (NpgsqlConnection connection = new NpgsqlConnection(dbparcels.GetConnectionString()))
//{
// connection.Open();
// NpgsqlCommand updateCmd = connection.CreateCommand();
// string updateSql = string.Format($"UPDATE {schemaname}.{parceltablename} SET downloadtime = '{strTime(watch.Elapsed)}' WHERE arbid = {bulkSatDownloadInput.fieldID};");
// updateCmd.CommandText = updateSql;
// int r = updateCmd.ExecuteNonQuery();
// if (r != 1)
// throw new Exception("// FarmmapsBulkSatDownload: Update downloadtime Failed");
// connection.Close();
//}
//_logger.LogInformation($"// FarmmapsBulkSatDownload: Added downloadtime = '{strTime(watch.Elapsed)}' to {schemaname}.{parceltablename} ");
tsSofar = tsSofar + watch.Elapsed;
tsTotalEstimated = tsSofar / (i + 1) * bulkSatDownloadInputList.Count;
tsRemaining = tsTotalEstimated - tsSofar;
_logger.LogInformation(string.Format($"// Time (hh:mm:ss): this field: {strTime(watch.Elapsed)}. Sofar: {strTime(tsSofar)}. Total: {strTime(tsTotalEstimated)}. Remaining: {strTime(tsRemaining)}"));
}
string strExeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
string strWorkPath = Path.GetDirectoryName(strExeFilePath);
_logger.LogInformation(string.Format($"// FarmmapsBulkSatDownload:"));
_logger.LogInformation(string.Format($"// FarmmapsBulkSatDownload: Done! List of all downloaded cropfieldItems stored in {Path.Combine(strWorkPath,settingsfile)}"));
_logger.LogInformation(string.Format($"// FarmmapsBulkSatDownload: If you plan to rerun certain fields then adding cropfielditemcode to your input can greatly speed up your application!"));
}
private async Task Process(List<UserRoot> roots, BulkSatDownloadInput input)
{
string cropfielditemcode;
string satellitetaskcode;
Item cropfieldItem;
bool satelliteItemsAvailable;
bool statsAvailable;
DateTime dtSatelliteDate;
string strSatelliteDate;
List<Item> satelliteItemsCropYear;
StringBuilder sbInsertSql;
StringBuilder sbInsertSqlInto;
StringBuilder sbInsertSqlUpdate;
StringBuilder sbInsertSqlValues;
List<SatelliteStatistics> listSatelliteStatistics;
SatelliteStatistics satelliteStatistics_wdvi;
SatelliteStatistics satelliteStatistics_ndvi;
int cntDatesDownloaded;
string satelliteSource = "akkerwebwenr"; //same as in groenmonitorlatestviewname SQL code
int fieldID = input.fieldID;
string fieldName = input.fieldName;
int cropYear = input.cropYear;
List<string> satelliteBands = input.SatelliteBands;
string downloadFolder = input.downloadFolder;
string fileNameStats = input.fileNameStats;
DB database = input.database;
string schemaname = input.schemaname;
string cropfieldtable = input.cropfieldtable;
string satelllitetable = input.satelllitetable;
DateTime lastDownloadedSatelliteDate = input.lastdownloadedimagedate;
cropfielditemcode = input.cropfielditemcode;
satellitetaskcode = input.satellitetaskcode;
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;
}
if (string.IsNullOrEmpty(cropfielditemcode))
{
_logger.LogInformation(string.Format($"Creating cropfield '{fieldName}' in the year {cropYear}"));
cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code,
$"DataCropfield {fieldName}", cropYear, input.GeometryJson.ToString(Formatting.None));
cropfielditemcode = cropfieldItem.Code;
// If working with a database, add this cropfieldItem.Code to the database so that next case same cropField is requested, will be faster
if (database != null)
{
// add this cropfielditemcode to the cropfieldtable
using (NpgsqlConnection connection = new NpgsqlConnection(database.GetConnectionString()))
{
connection.Open();
NpgsqlCommand updateCmd = connection.CreateCommand();
string updateSql = string.Format($"UPDATE {schemaname}.{cropfieldtable} SET cropfielditemcode = '{cropfieldItem.Code}' WHERE arbid = {fieldID};");
updateCmd.CommandText = updateSql;
//Console.WriteLine(insertCmd.CommandText);
int r = updateCmd.ExecuteNonQuery();
if (r != 1)
throw new Exception("// FarmmapsBulkSatDownload: Update cropfielditemcode Failed");
connection.Close();
}
_logger.LogInformation($"// FarmmapsBulkSatDownload: Added cropfieldItem.Code '{cropfieldItem.Code}' for parcelid {fieldID} to {schemaname}.{cropfieldtable} ");
}
}
else
{
// WOULD IT BE POSSIBLE TO GET AVAILABLE Item MEMBER VALUES FOR A GIVEN cropfielditemcode?
cropfieldItem = new Item();
cropfieldItem.Code = cropfielditemcode;
cropfieldItem.Name = "DataCropfield " + fieldName;
_logger.LogInformation($"// FarmmapsBulkSatDownload: CropfieldItem.Code for parcelid {fieldID} already there in {schemaname}.{cropfieldtable}: '{cropfieldItem.Code}'");
}
_settings.cropFieldItems.Add(cropfieldItem);
SaveSettings(settingsfile);
//Create satelliteTaskCode & save satelliteTaskCode.Code to settingsfile for retracing last call (can be useful if failed)
//_logger.LogInformation(string.Format($"Running RunSatelliteTask for cropfieldItem '{cropfielditemcode}' and saving settings to {settingsfile}"));
//var satelliteTaskCode = await _generalService.RunSatelliteTask(cropfieldItem);
if (string.IsNullOrEmpty(satellitetaskcode))
{
_logger.LogInformation(string.Format($"Running RunSatelliteTask for cropfieldItem '{cropfielditemcode}'"));
satellitetaskcode = await _generalService.RunSatelliteTask(cropfieldItem);
// If working with a database, add this cropfieldItem.Code to the database so that next case same cropField is requested, will be faster
if (database != null)
{
// add this satellitetaskcode to the cropfieldtable
using (NpgsqlConnection connection = new NpgsqlConnection(database.GetConnectionString()))
{
connection.Open();
NpgsqlCommand updateCmd = connection.CreateCommand();
string updateSql = string.Format($"UPDATE {schemaname}.{cropfieldtable} SET satellitetaskcode = '{satellitetaskcode}' WHERE arbid = {fieldID};");
updateCmd.CommandText = updateSql;
//Console.WriteLine(insertCmd.CommandText);
int r = updateCmd.ExecuteNonQuery();
if (r != 1)
throw new Exception("// FarmmapsBulkSatDownload: Update satellitetaskcode Failed");
connection.Close();
}
_logger.LogInformation($"// FarmmapsBulkSatDownload: Added satellitetaskcode '{satellitetaskcode}' for cropfieldItem.Code '{cropfieldItem.Code}' to {schemaname}.{cropfieldtable} ");
}
}
else
{
_logger.LogInformation($"// FarmmapsBulkSatDownload: satellitetaskcode for parcelid {fieldID} already there in {schemaname}.{cropfieldtable}: '{satellitetaskcode}'");
}
// TODO also log satellitetaskcode to settings, how?
// SaveSettings(settingsfile);
// Getting satellite items
_logger.LogInformation(string.Format($"Running FindSatelliteItems for cropfieldItem.Code '{cropfieldItem.Code}', SatelliteTaskCode '{satellitetaskcode}'"));
satelliteItemsCropYear = await _generalService.FindSatelliteItems(cropfieldItem, satellitetaskcode);
// Checking if satellite items found
satelliteItemsAvailable = true;
if (satelliteItemsCropYear == null)
{
satelliteItemsAvailable = false;
_logger.LogInformation($"No satellite tiffs found for fieldName '{fieldName}', cropYear {cropYear}, cropfielditemcode '{cropfielditemcode}'");
}
else
{
if (satelliteItemsCropYear.Count == 0)
{
satelliteItemsAvailable = false;
_logger.LogInformation($"No satellite tiffs found for fieldName '{fieldName}', cropYear {cropYear}, cropfielditemcode '{cropfielditemcode}'");
}
}
// Sort the list by date
if (satelliteItemsAvailable) satelliteItemsCropYear = satelliteItemsCropYear.OrderBy(x => x.DataDate).ToList();
// Download statistics to a single csv file
if (satelliteItemsAvailable && downloadFolder != null && fileNameStats != null)
{
// Write statistics for all images for all fieldNane and cropYear to a single csv file, fileNameStats
_logger.LogInformation($"Downloading stats for field '{fieldName}' in cropyear {cropYear} to {fileNameStats}");
string downloadedStats = await _generalService.DownloadSatelliteStats(satelliteItemsCropYear, fieldName, satelliteBands, downloadFolder);
// Add contents of this csv file to thee single large csv file
var retainedLines = File.ReadAllLines(downloadedStats).Skip(1);
File.AppendAllLines(fileNameStats, retainedLines);
File.Delete(downloadedStats);
// Optionally, also download the zipped tiffs. This can be a lot of files and increase runtime
if (false)
{
foreach (Item selectedSatelliteItem in satelliteItemsCropYear)
{
// download the geotiffs. Returns a zip file with always these three files:
// data.dat.aux.xml
// thumbnail.jpg
// wenr.tif. Contains 5 layers: (1) ndvi, (2) wdvi, (3) Red, (4) Green and (5) Blue
var SatelliteDate = selectedSatelliteItem.DataDate.Value.ToString("yyyyMMdd");
_logger.LogInformation($"Downloading geotiff file for field {fieldName}, date {SatelliteDate}");
string fileName = string.Format($"satelliteGeotiff_{fieldName}_{SatelliteDate}"); // no need to add satelliteBand in the name because the tif contains all bands
string fileNameZip = string.Format($"{fileName}.zip");
string fileNameGeotiff = string.Format($"{fileName}.tif");
await _farmmapsApiService.DownloadItemAsync(selectedSatelliteItem.Code, Path.Combine(downloadFolder, fileNameZip));
if (false)
{
// Extract the file "wenr.tif" from zip, rename it to fileNameGeotiff
ZipFile.ExtractToDirectory(Path.Combine(downloadFolder, fileNameZip), downloadFolder, true);
File.Delete(Path.Combine(downloadFolder, fileNameGeotiff)); // Delete the fileNameGeotiff file if exists
File.Move(Path.Combine(downloadFolder, "wenr.tif"), Path.Combine(downloadFolder, fileNameGeotiff)); // Rename the oldFileName into newFileName
// Cleanup
string[] filesToDelete = new string[] { fileNameZip, "wenr.tif", "thumbnail.jpg", "data.dat.aux.xml" };
foreach (string f in filesToDelete)
{
File.Delete(Path.Combine(downloadFolder, f));
}
}
}
}
}
// Download statistics to database
if (satelliteItemsAvailable && database != null)
{
// Tailormade code for writing to database
// No unnecessary intermediate step here of writing to csv and getting stats for all images in the crop year.
// Efficient is to check if there is any image for which stats are to be added to database and add only add these new stats for not yet archived dates directly to database
// A full check of downloaded dates versus available dates in the database is not made here.
// We assume only new images will be added (i.e. for later dates), assuming no historical images are added in groenmonitor (check!).
// And we assume farmMaps always nicely generates statistics, no hick-ups
// Under this assumptions, we only need to compare with the lastDownloadedSatelliteDate from the database
cntDatesDownloaded = 0;
using (NpgsqlConnection connection = new NpgsqlConnection(database.GetConnectionString()))
{
connection.Open();
foreach (Item satelliteItem in satelliteItemsCropYear)
{
dtSatelliteDate = satelliteItem.DataDate.Value;
strSatelliteDate = dtSatelliteDate.ToString("yyyy-MM-dd");
listSatelliteStatistics = await _generalService.ListSatelliteStatistics(satelliteItem, satelliteBands, fieldName);
statsAvailable = true;
if (listSatelliteStatistics == null)
{
statsAvailable = false;
_logger.LogWarning($"No stats found for satellite, fieldName '{fieldName}', date '{strSatelliteDate}'");
}
else
{
if (listSatelliteStatistics.Count == 0)
{
statsAvailable = false;
_logger.LogWarning($"No stats found for satellite, fieldName '{fieldName}', date '{strSatelliteDate}'");
}
}
if (statsAvailable)
{
if (dtSatelliteDate <= input.lastdownloadedimagedate)
{
_logger.LogInformation($"// Stats for parcelid {fieldID}, date '{strSatelliteDate}' already there in {schemaname}.{satelllitetable}");
}
else
{
cntDatesDownloaded++;
// Map satelliteStatistics to groenmonitorTable
satelliteStatistics_wdvi = listSatelliteStatistics.SingleOrDefault(p => p.satelliteBand == "wdvi");
satelliteStatistics_ndvi = listSatelliteStatistics.SingleOrDefault(p => p.satelliteBand == "ndvi");
sbInsertSql = new StringBuilder();
sbInsertSqlInto = new StringBuilder();
sbInsertSqlUpdate = new StringBuilder();
sbInsertSqlValues = new StringBuilder();
sbInsertSqlInto.Append($"INSERT INTO {schemaname}.{satelllitetable} (parcelid,date,source");
sbInsertSqlValues.Append($"VALUES ({fieldID},'{strSatelliteDate}','{satelliteSource}'");
sbInsertSqlUpdate.Append($"ON CONFLICT (parcelid,date,source) DO UPDATE SET parcelid={fieldID}, date='{strSatelliteDate}',source='{satelliteSource}'");
if (satelliteBands.Contains("wdvi"))
{
if (satelliteStatistics_wdvi != null)
{
sbInsertSqlInto.Append(",wdvi_pixelcount,wdvi_max,wdvi_mean,wdvi_min,wdvi_stdev,wdvi_median");
sbInsertSqlValues.Append($",{satelliteStatistics_wdvi.populationCount},{satelliteStatistics_wdvi.max},{satelliteStatistics_wdvi.mean},{satelliteStatistics_wdvi.min},{satelliteStatistics_wdvi.stddev},{satelliteStatistics_wdvi.median}");
sbInsertSqlUpdate.Append($",wdvi_pixelcount={satelliteStatistics_wdvi.populationCount},wdvi_max={satelliteStatistics_wdvi.max},wdvi_mean={satelliteStatistics_wdvi.mean},wdvi_min={satelliteStatistics_wdvi.min},wdvi_stdev={satelliteStatistics_wdvi.stddev},wdvi_median={satelliteStatistics_wdvi.median}");
}
else
{
_logger.LogWarning($"wdvi missing for cropfielditemcode {cropfielditemcode}, date '{strSatelliteDate}'");
}
}
if (satelliteBands.Contains("ndvi"))
{
if (satelliteStatistics_ndvi != null)
{
sbInsertSqlInto.Append(",ndvi_pixelcount,ndvi_max,ndvi_mean,ndvi_min,ndvi_stdev,ndvi_median");
sbInsertSqlValues.Append($",{satelliteStatistics_ndvi.populationCount},{satelliteStatistics_ndvi.max},{satelliteStatistics_ndvi.mean},{satelliteStatistics_ndvi.min},{satelliteStatistics_ndvi.stddev},{satelliteStatistics_ndvi.median}");
sbInsertSqlUpdate.Append($",ndvi_pixelcount={satelliteStatistics_ndvi.populationCount},ndvi_max={satelliteStatistics_ndvi.max},ndvi_mean={satelliteStatistics_ndvi.mean},ndvi_min={satelliteStatistics_ndvi.min},ndvi_stdev={satelliteStatistics_ndvi.stddev},ndvi_median={satelliteStatistics_ndvi.median}");
}
else
{
_logger.LogWarning($"ndvi missing for cropfielditemcode {cropfielditemcode}, date '{strSatelliteDate}'");
}
}
sbInsertSqlInto.Append(")");
sbInsertSqlValues.Append(")");
sbInsertSql.AppendLine(sbInsertSqlInto.ToString());
sbInsertSql.AppendLine(sbInsertSqlValues.ToString());
sbInsertSql.AppendLine(sbInsertSqlUpdate.ToString());
//string strInsertSql = sbInsertSql.ToString();
NpgsqlCommand insertCmd = connection.CreateCommand();
insertCmd.CommandText = sbInsertSql.ToString();
//Console.WriteLine(insertCmd.CommandText);
int r = insertCmd.ExecuteNonQuery();
if (r != 1)
throw new Exception("// FarmmapsBulkSatDownload: Insert Failed");
_logger.LogInformation($"// Added stats to {schemaname}.{satelllitetable} for parcelid {fieldID}, date '{strSatelliteDate}'. cntDatesDownloaded: {cntDatesDownloaded}");
}
}
}
connection.Close();
}
}
}
// Functions to save previously created cropfields
private void LoadSettings(string file)
{
if (File.Exists(file))
{
var jsonText = File.ReadAllText(file);
_settings = JsonConvert.DeserializeObject<Settings>(jsonText);
}
else
{
Settings settings = new Settings();
settings.cropFieldItems = new List<Item>();
_settings = settings;
}
}
private void SaveSettings(string file)
{
if (_settings == null)
return;
var json = JsonConvert.SerializeObject(_settings);
File.WriteAllText(file, json);
}
private string strTime(TimeSpan ts)
{
return String.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds);
}
}
}

View File

@ -0,0 +1,262 @@
[
{
"fieldName": "5641", // FarmMaps minimum needs are: fieldName, cropYear & geometryJson
"cropYear": 1999, //For testing a year for which we know no satellite data available, program shouldn't crash
"fieldID": 5641,
"SatelliteBands": [ "wdvi", "ndvi" ], // ["ndvi"] or ["wdvi"] or both: [ "wdvi", "ndvi" ]
"lastdownloadedimagedate": "1999-01-01", //downloads images from this date till end of the year
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.37837807779104, 51.3231095796538 ],
[ 3.38065689232502, 51.3212527499355 ],
[ 3.38022924592256, 51.3210683536359 ],
[ 3.37980548452565, 51.3208801127141 ],
[ 3.37959556105776, 51.3207540143696 ],
[ 3.3793691292654, 51.3205959677371 ],
[ 3.37822219207335, 51.3215667913007 ],
[ 3.37816999925795, 51.3216109809456 ],
[ 3.37646704574705, 51.3208025481261 ],
[ 3.37646695791282, 51.3208025061493 ],
[ 3.37608401443192, 51.3206231652693 ],
[ 3.37607169507628, 51.3206173959751 ],
[ 3.37606021048754, 51.320612017601 ],
[ 3.37582728410659, 51.3205029306946 ],
[ 3.37580409779263, 51.3206502985963 ],
[ 3.37575872019649, 51.3207993094705 ],
[ 3.37575476634361, 51.3208122883487 ],
[ 3.37571181656268, 51.3208797459348 ],
[ 3.3756624532907, 51.3209415238446 ],
[ 3.37557609963811, 51.3210110142077 ],
[ 3.37541089899821, 51.3211055871218 ],
[ 3.37477516102591, 51.3214102985009 ],
[ 3.37473173914127, 51.3214311108204 ],
[ 3.37455904622072, 51.3215138815012 ],
[ 3.37415098054777, 51.3217199232877 ],
[ 3.37313700916272, 51.3222422862785 ],
[ 3.37748824689601, 51.3242852920348 ],
[ 3.37749760805371, 51.3242713084009 ],
[ 3.37811903757028, 51.3233437635596 ],
[ 3.37818758851947, 51.3232647797363 ],
[ 3.37823803668144, 51.3232236798646 ],
[ 3.37837807779104, 51.3231095796538 ]
]
]
},
"downloadFolder": "C:\\workdir\\groenmonitor\\",
"fileNameStats": "BulkSatDownload.csv",
"database": null,
"schemaname": null,
"cropfieldtable": null,
"satelllitetable": null
},
{
"fieldName": "5641", // FarmMaps minimum needs are: fieldName, cropYear & geometryJson
"cropYear": 2021, //For testing a year for which we know no satellite data available, program shouldn't crash
"fieldID": 5641,
"SatelliteBands": [ "wdvi", "ndvi" ], // ["ndvi"] or ["wdvi"] or both: [ "wdvi", "ndvi" ]
"lastdownloadedimagedate": "2021-01-01", //downloads images from this date till end of the year
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.37837807779104, 51.3231095796538 ],
[ 3.38065689232502, 51.3212527499355 ],
[ 3.38022924592256, 51.3210683536359 ],
[ 3.37980548452565, 51.3208801127141 ],
[ 3.37959556105776, 51.3207540143696 ],
[ 3.3793691292654, 51.3205959677371 ],
[ 3.37822219207335, 51.3215667913007 ],
[ 3.37816999925795, 51.3216109809456 ],
[ 3.37646704574705, 51.3208025481261 ],
[ 3.37646695791282, 51.3208025061493 ],
[ 3.37608401443192, 51.3206231652693 ],
[ 3.37607169507628, 51.3206173959751 ],
[ 3.37606021048754, 51.320612017601 ],
[ 3.37582728410659, 51.3205029306946 ],
[ 3.37580409779263, 51.3206502985963 ],
[ 3.37575872019649, 51.3207993094705 ],
[ 3.37575476634361, 51.3208122883487 ],
[ 3.37571181656268, 51.3208797459348 ],
[ 3.3756624532907, 51.3209415238446 ],
[ 3.37557609963811, 51.3210110142077 ],
[ 3.37541089899821, 51.3211055871218 ],
[ 3.37477516102591, 51.3214102985009 ],
[ 3.37473173914127, 51.3214311108204 ],
[ 3.37455904622072, 51.3215138815012 ],
[ 3.37415098054777, 51.3217199232877 ],
[ 3.37313700916272, 51.3222422862785 ],
[ 3.37748824689601, 51.3242852920348 ],
[ 3.37749760805371, 51.3242713084009 ],
[ 3.37811903757028, 51.3233437635596 ],
[ 3.37818758851947, 51.3232647797363 ],
[ 3.37823803668144, 51.3232236798646 ],
[ 3.37837807779104, 51.3231095796538 ]
]
]
},
"downloadFolder": "C:\\workdir\\groenmonitor\\",
"fileNameStats": "BulkSatDownload.csv",
"database": null,
"schemaname": null,
"cropfieldtable": null,
"satelllitetable": null
},
{
"fieldName": "5641", // FarmMaps minimum needs are: fieldName, cropYear & geometryJson
"cropYear": 2020,
"fieldID": 5641,
"SatelliteBands": [ "wdvi", "ndvi" ], // ["ndvi"] or ["wdvi"] or both: [ "wdvi", "ndvi" ]
"lastdownloadedimagedate": "2020-01-01", //downloads images from this date till end of the year
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.37837807779104, 51.3231095796538 ],
[ 3.38065689232502, 51.3212527499355 ],
[ 3.38022924592256, 51.3210683536359 ],
[ 3.37980548452565, 51.3208801127141 ],
[ 3.37959556105776, 51.3207540143696 ],
[ 3.3793691292654, 51.3205959677371 ],
[ 3.37822219207335, 51.3215667913007 ],
[ 3.37816999925795, 51.3216109809456 ],
[ 3.37646704574705, 51.3208025481261 ],
[ 3.37646695791282, 51.3208025061493 ],
[ 3.37608401443192, 51.3206231652693 ],
[ 3.37607169507628, 51.3206173959751 ],
[ 3.37606021048754, 51.320612017601 ],
[ 3.37582728410659, 51.3205029306946 ],
[ 3.37580409779263, 51.3206502985963 ],
[ 3.37575872019649, 51.3207993094705 ],
[ 3.37575476634361, 51.3208122883487 ],
[ 3.37571181656268, 51.3208797459348 ],
[ 3.3756624532907, 51.3209415238446 ],
[ 3.37557609963811, 51.3210110142077 ],
[ 3.37541089899821, 51.3211055871218 ],
[ 3.37477516102591, 51.3214102985009 ],
[ 3.37473173914127, 51.3214311108204 ],
[ 3.37455904622072, 51.3215138815012 ],
[ 3.37415098054777, 51.3217199232877 ],
[ 3.37313700916272, 51.3222422862785 ],
[ 3.37748824689601, 51.3242852920348 ],
[ 3.37749760805371, 51.3242713084009 ],
[ 3.37811903757028, 51.3233437635596 ],
[ 3.37818758851947, 51.3232647797363 ],
[ 3.37823803668144, 51.3232236798646 ],
[ 3.37837807779104, 51.3231095796538 ]
]
]
},
"downloadFolder": "C:\\workdir\\groenmonitor\\",
"fileNameStats": "BulkSatDownload.csv",
"database": null,
"schemaname": null,
"cropfieldtable": null,
"satelllitetable": null
},
{
"fieldName": "5641", // FarmMaps minimum needs are: fieldName, cropYear & geometryJson
"cropYear": 2019,
"fieldID": 5641,
"SatelliteBands": [ "wdvi", "ndvi" ], // ["ndvi"] or ["wdvi"] or both: [ "wdvi", "ndvi" ]
"lastdownloadedimagedate": "2019-01-01", //downloads images from this date till end of the year
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.37837807779104, 51.3231095796538 ],
[ 3.38065689232502, 51.3212527499355 ],
[ 3.38022924592256, 51.3210683536359 ],
[ 3.37980548452565, 51.3208801127141 ],
[ 3.37959556105776, 51.3207540143696 ],
[ 3.3793691292654, 51.3205959677371 ],
[ 3.37822219207335, 51.3215667913007 ],
[ 3.37816999925795, 51.3216109809456 ],
[ 3.37646704574705, 51.3208025481261 ],
[ 3.37646695791282, 51.3208025061493 ],
[ 3.37608401443192, 51.3206231652693 ],
[ 3.37607169507628, 51.3206173959751 ],
[ 3.37606021048754, 51.320612017601 ],
[ 3.37582728410659, 51.3205029306946 ],
[ 3.37580409779263, 51.3206502985963 ],
[ 3.37575872019649, 51.3207993094705 ],
[ 3.37575476634361, 51.3208122883487 ],
[ 3.37571181656268, 51.3208797459348 ],
[ 3.3756624532907, 51.3209415238446 ],
[ 3.37557609963811, 51.3210110142077 ],
[ 3.37541089899821, 51.3211055871218 ],
[ 3.37477516102591, 51.3214102985009 ],
[ 3.37473173914127, 51.3214311108204 ],
[ 3.37455904622072, 51.3215138815012 ],
[ 3.37415098054777, 51.3217199232877 ],
[ 3.37313700916272, 51.3222422862785 ],
[ 3.37748824689601, 51.3242852920348 ],
[ 3.37749760805371, 51.3242713084009 ],
[ 3.37811903757028, 51.3233437635596 ],
[ 3.37818758851947, 51.3232647797363 ],
[ 3.37823803668144, 51.3232236798646 ],
[ 3.37837807779104, 51.3231095796538 ]
]
]
},
"downloadFolder": "C:\\workdir\\groenmonitor\\",
"fileNameStats": "BulkSatDownload.csv",
"database": null,
"schemaname": null,
"cropfieldtable": null,
"satelllitetable": null
},
{
"fieldName": "5641", // FarmMaps minimum needs are: fieldName, cropYear & geometryJson
"cropYear": 2018, //little to no images for 2018
"fieldID": 5641,
"SatelliteBands": [ "wdvi", "ndvi" ], // ["ndvi"] or ["wdvi"] or both: [ "wdvi", "ndvi" ]
"lastdownloadedimagedate": "2018-01-01", //downloads images from this date till end of the year
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.37837807779104, 51.3231095796538 ],
[ 3.38065689232502, 51.3212527499355 ],
[ 3.38022924592256, 51.3210683536359 ],
[ 3.37980548452565, 51.3208801127141 ],
[ 3.37959556105776, 51.3207540143696 ],
[ 3.3793691292654, 51.3205959677371 ],
[ 3.37822219207335, 51.3215667913007 ],
[ 3.37816999925795, 51.3216109809456 ],
[ 3.37646704574705, 51.3208025481261 ],
[ 3.37646695791282, 51.3208025061493 ],
[ 3.37608401443192, 51.3206231652693 ],
[ 3.37607169507628, 51.3206173959751 ],
[ 3.37606021048754, 51.320612017601 ],
[ 3.37582728410659, 51.3205029306946 ],
[ 3.37580409779263, 51.3206502985963 ],
[ 3.37575872019649, 51.3207993094705 ],
[ 3.37575476634361, 51.3208122883487 ],
[ 3.37571181656268, 51.3208797459348 ],
[ 3.3756624532907, 51.3209415238446 ],
[ 3.37557609963811, 51.3210110142077 ],
[ 3.37541089899821, 51.3211055871218 ],
[ 3.37477516102591, 51.3214102985009 ],
[ 3.37473173914127, 51.3214311108204 ],
[ 3.37455904622072, 51.3215138815012 ],
[ 3.37415098054777, 51.3217199232877 ],
[ 3.37313700916272, 51.3222422862785 ],
[ 3.37748824689601, 51.3242852920348 ],
[ 3.37749760805371, 51.3242713084009 ],
[ 3.37811903757028, 51.3233437635596 ],
[ 3.37818758851947, 51.3232647797363 ],
[ 3.37823803668144, 51.3232236798646 ],
[ 3.37837807779104, 51.3231095796538 ]
]
]
},
"downloadFolder": "C:\\workdir\\groenmonitor\\",
"fileNameStats": "BulkSatDownload.csv",
"database": null,
"schemaname": null,
"cropfieldtable": null,
"satelllitetable": null
}
]

View File

@ -0,0 +1,29 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using FarmmapsApi.Models;
using FarmmapsApi.Services;
using FarmmapsBulkSatDownload.Models;
using Microsoft.Extensions.Logging;
using static FarmmapsApi.Extensions;
using static FarmmapsApiSamples.Constants;
namespace FarmmapsBulkSatDownload
{
public class BulkSatDownloadService
{
private readonly ILogger<BulkSatDownloadService> _logger;
private readonly FarmmapsApiService _farmmapsApiService;
private readonly GeneralService _generalService;
public BulkSatDownloadService(ILogger<BulkSatDownloadService> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService)
{
_logger = logger;
_farmmapsApiService = farmmapsApiService;
_generalService = generalService;
}
}
}

View File

@ -0,0 +1,6 @@
{
"User": "",
"Password": "",
"Database": "",
"Host": ""
}

View File

@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>5</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="5.0.5" />
</ItemGroup>
<ItemGroup>
<None Update="Data\**\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="BulkSatDownloadInput.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DBsettings.secrets.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FarmmapsApi\FarmmapsApi.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace FarmmapsBulkSatDownload.Models
{
public class BulkSatDownloadInput
{
public string fieldName { get; set; }
public int cropYear { get; set; }
public int fieldID { get; set; }
public List<string> SatelliteBands { get; set; }
public DateTime lastdownloadedimagedate { get; set; }
public JObject GeometryJson { get; set; }
public string cropfielditemcode { get; set; }
public string satellitetaskcode { get; set; }
public string downloadFolder { get; set; }
public string fileNameStats { get; set; }
public DB database { get; set; }
public string schemaname { get; set; }
public string cropfieldtable { get; set; }
public string satelllitetable { get; set; }
}
}

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Text;
using Npgsql;
namespace FarmmapsBulkSatDownload.Models
{
public class DB
{
public string Database;
public string User;
public string Password;
public string Host;
public string GetConnectionString()
{
NpgsqlConnectionStringBuilder sb = new NpgsqlConnectionStringBuilder();
sb.Database = Database;
sb.Host = Host;
sb.Username = User;
sb.Password = Password;
sb.Port = 5432;
return sb.ConnectionString;
}
public int ExecuteNonQuery(string sql)
{
using (NpgsqlConnection conn = new NpgsqlConnection(GetConnectionString()))
{
conn.Open();
NpgsqlCommand command = conn.CreateCommand();
command.CommandText = sql;
int r = command.ExecuteNonQuery();
return r;
}
}
public NpgsqlConnection CreateConnection()
{
NpgsqlConnection conn = new NpgsqlConnection(GetConnectionString());
conn.Open();
return conn;
}
}
}

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
using FarmmapsApi.Models;
namespace FarmmapsBulkSatDownload
{
public class Settings
{
public List<Item> cropFieldItems { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using System.Threading.Tasks;
using FarmmapsApi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FarmmapsBulkSatDownload
{
class Program : FarmmapsProgram<BulkSatDownloadApplication>
{
private static async Task Main(string[] args)
{
await new Program().Start(args);
}
protected override void Configure(IServiceCollection serviceCollection)
{
serviceCollection.AddLogging()
.AddTransient<BulkSatDownloadService>();
}
}
}

View File

@ -0,0 +1,178 @@
# ShowGeotiff.r
# I downloaded and calculated the stats for the polygon defined in C:\git\FarmMapsApiClient_WURtest\FarmmapsDataDownload\DataDownloadInput.json
# in which I set "SatelliteBand": "wdvi" and in which in the console I requested the image for date '2020-09-22'
# FarmmapsBulkSatDownload generates many files. Here is what I tried when inputing the same field for a number of years using BulkSatDownloadInput.json
# see list below
library(raster)
library(sf)
library(rgdal)
setwd("C:/workdir/groenmonitor/DataDownload/")
# FarmmapsDataDownload and BulkSatDownload can be used to download zip files with inside two files:
fileGeotiff <- "wenr.tif"
fileJpg <- "thumbnail.jpg"
# Here is what I tried when inputing the same field for a number of years:
# fileGeotiff <- "wheat_fld5641_20210224.tif" # 2 files for year 2021. This file is a nice example having in upperleft corner no data
# fileGeotiff <- "wheat_fld5641_20210331.tif" # 2 files for year 2021
# fileGeotiff <- "wheat_fld5641_20200321.tif" # 14 files for year 2020, earliest
# fileGeotiff <- "wheat_fld5641_20200922.tif" # 14 files for year 2020, latest
# fileGeotiff <- "wheat_fld5641_20190121.tif" # 9 files for year 2019, earliest
# fileGeotiff <- "wheat_fld5641_20191117.tif" # 9 files for year 2019, latest
# 1 file for year 2018, with error message 'End of Central Directory record could not be found' and invalid wheat_fld5641_20180630.zip
# fileGeotiff <- "wheat_fld5641_20170526.tif" # 1 file for year 2017
# Zero files for 2016
lenfilename <- nchar(fileGeotiff)
year <- substr(fileGeotiff,lenfilename-11,lenfilename-8)
imgdate <- substr(fileGeotiff,lenfilename-11,lenfilename-4)
# The thumbnail has the polygon clipped out, has 1 layer, no crs and the mean value is not the mean wdvi we are looking for
r.thumbnail <- raster(fileJpg)
plot(r.thumbnail)
crs(r.thumbnail)
#CRS arguments: NA
cellStats(r.thumbnail,'mean') #87.5128 # nonsense
stk.wenr <- stack(x=fileGeotiff)
# plot(stk.wenr) shows 5 plots (5 bands)
# I think these are:
# 1. ndvi (since it runs from 0 to 1)
# 2. wdvi (since it runs from 0 to 0.5)
# 3-5: RGB (since they run from 0 to 255)
plot(stk.wenr)
# CRS arguments:
# +proj=sterea +lat_0=52.1561605555556 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs
# Or use st_crs(stk.wenr) to get more info, but no EPSG code in there.
# Likely it is epsg:28992 (Amersfoort)
crs(stk.wenr)
stk.wenr <- projectRaster(stk.wenr, crs = CRS('+init=EPSG:28992'))
crs(stk.wenr)
# Looks the same but strangely, if we don't do projectRaster(stk.wenr, crs = CRS('+init=EPSG:28992')), we find below the bottom left corner of the polygon missing
r.wenr.rd.wdvi <- subset(stk.wenr,2)
dev.off()
plot(r.wenr.rd.wdvi,main=paste("wdvi",imgdate),xlab="RDX",ylab="RDY")
cellStats(r.wenr.rd.wdvi,'mean') #0.1350561
# Furthermore we can see
# shows coordinates in RD
# returns a rectangle, thus the shape of the polygon submitted is not clipped.
# The polygon was provided in WGS84. Let's draw it on top.
# First convert the raster to WGS84
r.wenr.wgs84.wdvi <- projectRaster(r.wenr.rd.wdvi, crs = CRS('+init=EPSG:4326'))
# Draw a polygon on top of the raster
# Example polygon p1
# p1 <- data.frame(id = 1, wkt = 'POLYGON((4.963 52.801, 4.966 52.801, 4.966 52.803, 4.963 52.803, 4.963 52.801))')
# p1 <- st_as_sf(p1, wkt = 'wkt', crs = targetcrs)
# plot(p1,add=TRUE, col="transparent",border="black")
# Draw the polygon on top of the raster
# Polygon p2 from C:\git\FarmMapsApiClient_WURtest\FarmmapsDataDownload\DataDownloadInput.json
p2 <- data.frame(id = 1, wkt = gsub("\n","",'POLYGON((
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))'))
# Polygon p2 from C:\git\FarmMapsApiClient_WURtest\FarmmapsBulkSatDownload\BulkSatDownloadInput.json
p2 <- data.frame(id = 1, wkt = gsub("\n","",'POLYGON((
3.37837807779104 51.3231095796538,
3.38065689232502 51.3212527499355,
3.38022924592256 51.3210683536359,
3.37980548452565 51.3208801127141,
3.37959556105776 51.3207540143696,
3.3793691292654 51.3205959677371,
3.37822219207335 51.3215667913007,
3.37816999925795 51.3216109809456,
3.37646704574705 51.3208025481261,
3.37646695791282 51.3208025061493,
3.37608401443192 51.3206231652693,
3.37607169507628 51.3206173959751,
3.37606021048754 51.320612017601,
3.37582728410659 51.3205029306946,
3.37580409779263 51.3206502985963,
3.37575872019649 51.3207993094705,
3.37575476634361 51.3208122883487,
3.37571181656268 51.3208797459348,
3.3756624532907 51.3209415238446,
3.37557609963811 51.3210110142077,
3.37541089899821 51.3211055871218,
3.37477516102591 51.3214102985009,
3.37473173914127 51.3214311108204,
3.37455904622072 51.3215138815012,
3.37415098054777 51.3217199232877,
3.37313700916272 51.3222422862785,
3.37748824689601 51.3242852920348,
3.37749760805371 51.3242713084009,
3.37811903757028 51.3233437635596,
3.37818758851947 51.3232647797363,
3.37823803668144 51.3232236798646,
3.37837807779104 51.3231095796538))'))
p2.wgs84 <- st_as_sf(p2, wkt = 'wkt', crs = CRS('+init=EPSG:4326'))
# Or other way round, in RD Amersfoort. That looks ok
p2.rd <- st_transform(p2.wgs84, "+init=epsg:28992")
# Have a look at both
# wg84
dev.off()
plot(r.wenr.wgs84.wdvi,main=paste("wdvi",imgdate),xlab="LON",ylab="LAT")
plot(p2.wgs84,add=TRUE, col="transparent",border="red")
# RD
dev.off()
plot(r.wenr.rd.wdvi,main=paste("wdvi",imgdate),xlab="RDX",ylab="RDY")
plot(p2.rd,add=TRUE, col="transparent",border="red")
#Let's clip the polygon
r.wenr.rd.wdvi.pol <- mask(r.wenr.rd.wdvi,p2.rd)
r.wenr.wgs84.wdvi.pol <- mask(r.wenr.wgs84.wdvi,p2.wgs84)
dev.off()
plot(r.wenr.wgs84.wdvi.pol,main=paste("wdvi",imgdate),xlab="LON",ylab="LAT")
plot(p2.wgs84,add=TRUE, col="transparent",border="red")
#That's what we want! Now compare the stats
cellStats(r.wenr.rd.wdvi,'mean') # [1] 0.1350561 # Stats from rectangle, RD
cellStats(r.wenr.wgs84.wdvi,'mean') # [1] 0.1351411 # Stats from rectangle, WGS84
cellStats(r.wenr.rd.wdvi.pol,'mean') # [1] 0.05723957 # Stats from raster clipped by polygon, RD
cellStats(r.wenr.wgs84.wdvi.pol,'mean') # [1] 0.05723607 # Stats from raster clipped by polygon, WGS84
# file SatelliteDataStatistics_test_satData_wdvi_2020-09-22.csv
# "mean": 0.057430520945401985 # SatelliteDataStatistics_test_satData_wdvi_2020.csv returns stats for the clipped raster (.pol). 'mean' almost the same, maybe
# cellStats cannot return median, just a few stats.
cellStats(r.wenr.wgs84.wdvi.pol,'median') # Error in .local(x, stat, ...) : invalid 'stat'. Should be sum, min, max, sd, mean, or 'countNA'
r.wenr.wgs84.wdvi.vals <- values(r.wenr.wgs84.wdvi)
median(r.wenr.wgs84.wdvi.vals) # [1] NA
median(r.wenr.wgs84.wdvi.vals,na.rm=TRUE) # [1] 0.076
r.wenr.wgs84.wdvi.pol.vals <- values(r.wenr.wgs84.wdvi.pol)
median(r.wenr.wgs84.wdvi.pol.vals) # [1] NA
median(r.wenr.wgs84.wdvi.pol.vals,na.rm=TRUE) # [1] 0.048
# "median": 0.04800000041723251 # SatelliteDataStatistics_test_satData_wdvi_2020.csv returns stats for the clipped raster (.pol).
# An image may contain NA values. Check:
cellStats(r.wenr.wgs84.wdvi,'countNA') # [1] 22956
ncell(r.wenr.wgs84.wdvi) # [1] 221696
cellStats(r.wenr.wgs84.wdvi,'countNA') / ncell(r.wenr.wgs84.wdvi) # [1] 0.1035472 # 10% no data? doesn't show in the plot?
cellStats(r.wenr.wgs84.wdvi.pol,'countNA') # [1] 147387
summary(r.wenr.wgs84.wdvi.pol.vals) # shows the same: NA's: 147387
ncell(r.wenr.wgs84.wdvi.pol) # [1] 221696
cellStats(r.wenr.wgs84.wdvi.pol,'countNA') / ncell(r.wenr.wgs84.wdvi.pol) # [1] 0.6648158 # 66% no data? doesn't show in the plot?
# The project FarmmapsNbs can generate a wenr.tif file, application.tif, uptake.tif (in rtest1.uptake.zip)and shape.shp (in rtest1.taskmap.zip)
r.application <- raster("C:/git/FarmMapsApiClient_WURtest/FarmmapsNbs/bin/Debug/netcoreapp3.1/Downloads/application.tif")
dev.off()
plot(r.application)
plot(p2.rd,add=TRUE, col="transparent",border="red")
# The application.tif file is a rectangle (polygon not yet clipped), in projection Amersfoort RD New (EPSG:28992)
r.uptake <- raster("C:/git/FarmMapsApiClient_WURtest/FarmmapsNbs/bin/Debug/netcoreapp3.1/Downloads/uptake.tif")
dev.off()
plot(r.uptake)
plot(p2.rd,add=TRUE, col="transparent",border="red")
# The uptake.tif file is a rectangle (polygon not yet clipped), in projection Amersfoort RD New (EPSG:28992)
shp.wgs84 <- readOGR(dsn="C:/git/FarmMapsApiClient_WURtest/FarmmapsNbs/bin/Debug/netcoreapp3.1/Downloads", layer="shape")
crs(shp.wgs84)
# CRS arguments: +proj=longlat +datum=WGS84 +no_defs
dev.off()
plot(r.wenr.wgs84.wdvi,main="wdvi",xlab="LON",ylab="LAT")
plot(shp.wgs84,add=TRUE, col="transparent",border="black")
plot(p2.wgs84,add=TRUE, col="transparent",border="red")
# The shape file is in WGS84

View File

@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using FarmmapsApi;
using FarmmapsApi.Models;
using FarmmapsApi.Services;
using FarmmapsBulkSatDownload.Models;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Npgsql;
using Newtonsoft.Json.Linq;
using static FarmmapsApiSamples.Constants;
namespace FarmmapsCleanup
{
public class CleanupApplication : IApplication
{
private readonly ILogger<CleanupApplication> _logger;
private readonly FarmmapsApiService _farmmapsApiService;
private readonly CleanupService _cleanupService;
private readonly GeneralService _generalService;
public CleanupApplication(ILogger<CleanupApplication> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService, CleanupService cleanupService)
{
_logger = logger;
_farmmapsApiService = farmmapsApiService;
_generalService = generalService;
_cleanupService = cleanupService;
}
public async Task RunAsync()
{
// !! 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();
//Establish a database connection. Expecting you are using same database server as in project FarmmapsBulkSatDownload
DB dbparcels = JsonConvert.DeserializeObject<DB>(File.ReadAllText("DBsettings.secrets.json"));
string schemaname = "bigdata";
string parceltablename = "parcel_bollenrevolutie_tulips2020"; //"parcelsijbrandij" "parcel"; "parcel_flowerbulbs"; "parcel_disac"; ""parcel_bollenrevolutie_tulips2020""
//Query to get lists of items to delete from FarmmapsDatabase and from parceltablename
string cropfielditemcode;
string satellitetaskcode;
List<string> cropfieldItemCodes = new List<string>();
List<string> satellitetaskCodes = new List<string>();
string connectionString = dbparcels.GetConnectionString();
string readSql = string.Format(
@"
SELECT pt.cropfielditemcode, pt.satellitetaskcode
FROM {0}.{1} pt
WHERE
pt.arbid IN(1,2)
ORDER BY pt.arbid
;", schemaname, parceltablename);
string updateCropfieldItemCodesSql = string.Format(
@"
UPDATE {0}.{1}
SET cropfielditemcode=NULL
WHERE arbid IN(1,2)
;", schemaname, parceltablename); //Same WHERE AS above
string updateSatellitetaskCodesSql = string.Format(
@"
UPDATE {0}.{1}
SET satellitetaskcode=NULL
WHERE arbid IN(1,2)
;", schemaname, parceltablename); //Same WHERE AS above
using (NpgsqlConnection connection = new NpgsqlConnection(connectionString))
{
connection.Open();
// Read data (run query) = build a list of fields for which to download images
NpgsqlCommand command = connection.CreateCommand();
command.CommandText = readSql;
NpgsqlDataReader dr = command.ExecuteReader();
while (dr.Read())
{
cropfielditemcode = dr.GetString(0);
satellitetaskcode = dr.GetString(1);
if(!string.IsNullOrEmpty(cropfielditemcode))
cropfieldItemCodes.Add(cropfielditemcode);
if (!string.IsNullOrEmpty(satellitetaskcode))
satellitetaskCodes.Add(satellitetaskcode);
}
connection.Close();
}
_logger.LogWarning($"// FarmmapsCleanUp: WARNING: you are about to delete {cropfieldItemCodes.Count} cropfieldItemCodes and {satellitetaskCodes.Count} satellitetaskCodes from the FarmMaps database and your own table {schemaname}.{parceltablename}");
_logger.LogInformation($"// Nice of you to clean up after the work is done. You would typically do this for cropfieldItemCodes used only once.");
_logger.LogInformation($"// You do NOT want to do this if you think you may later on still want to use these items.");
_logger.LogInformation($"// Please carefully check the SQL queries 'readSql' 'updateSql' in CleanUpApplication.cs before proceeding.");
_logger.LogInformation($"// FarmmapsCleanUp: delete selected cropfieldItemCodes from FarmMaps database and table {schemaname}.{parceltablename}? 0 = no, 1 = yes");
int i;
i = Int32.Parse(Console.ReadLine());
if (i == 1)
{
await _farmmapsApiService.DeleteItemsAsync(cropfieldItemCodes);
//TODO _farmmapsApiService.DeleteItemsAsync throws an error: {StatusCode: 415, ReasonPhrase: 'Unsupported Media Type', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: {...}}
//what is wrong with cropfieldItemCodes?
//and shouldn't we be telling _farmmapsApiService.DeleteItemsAsync what item type to delete?
using (NpgsqlConnection connection = new NpgsqlConnection(connectionString))
{
connection.Open();
NpgsqlCommand updateCmd = connection.CreateCommand();
updateCmd.CommandText = updateCropfieldItemCodesSql;
int r = updateCmd.ExecuteNonQuery();
if (r == -1)
throw new Exception("// FarmmapsCleanUp: Update cropfielditemcode Failed");
connection.Close();
}
}
_logger.LogInformation($"// FarmmapsCleanUp: delete selected satellitetaskCodes from FarmMaps database and table {schemaname}.{parceltablename}? 0 = no, 1 = yes");
i = Int32.Parse(Console.ReadLine());
if (i == 1)
{
await _farmmapsApiService.DeleteItemsAsync(satellitetaskCodes);
//TODO _farmmapsApiService.DeleteItemsAsync throws an error: {StatusCode: 415, ReasonPhrase: 'Unsupported Media Type', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: {...}}
//what is wrong with satellitetaskCodes?
//and shouldn't we be telling _farmmapsApiService.DeleteItemsAsync what item type to delete?
using (NpgsqlConnection connection = new NpgsqlConnection(connectionString))
{
connection.Open();
NpgsqlCommand updateCmd = connection.CreateCommand();
updateCmd.CommandText = updateSatellitetaskCodesSql;
int r = updateCmd.ExecuteNonQuery();
if (r == -1)
throw new Exception("// FarmmapsCleanUp: Update cropfielditemcode Failed");
connection.Close();
}
}
_logger.LogInformation($"// FarmmapsCleanUp: done! Hit any key to exit ...");
Console.ReadKey();
}
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using FarmmapsApi.Models;
using FarmmapsApi.Services;
using Microsoft.Extensions.Logging;
using static FarmmapsApi.Extensions;
using static FarmmapsApiSamples.Constants;
namespace FarmmapsCleanup
{
public class CleanupService
{
private readonly ILogger<CleanupService> _logger;
private readonly FarmmapsApiService _farmmapsApiService;
private readonly GeneralService _generalService;
public CleanupService(ILogger<CleanupService> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService)
{
_logger = logger;
_farmmapsApiService = farmmapsApiService;
_generalService = generalService;
}
}
}

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="5.0.5" />
</ItemGroup>
<ItemGroup>
<None Update="Data\**\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FarmmapsApi\FarmmapsApi.csproj" />
<ProjectReference Include="..\FarmmapsBulkSatDownload\FarmmapsBulkSatDownload.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@
using System.Threading.Tasks;
using FarmmapsApi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FarmmapsCleanup
{
class Program : FarmmapsProgram<CleanupApplication>
{
private static async Task Main(string[] args)
{
await new Program().Start(args);
}
protected override void Configure(IServiceCollection serviceCollection)
{
serviceCollection.AddLogging()
.AddTransient<CleanupService>();
}
}
}

View File

@ -0,0 +1,265 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using FarmmapsApi;
using FarmmapsApi.Models;
using FarmmapsApi.Services;
using FarmmapsDataDownload.Models;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using static FarmmapsApiSamples.Constants;
namespace FarmmapsDataDownload
{
public class DataDownloadApplication : IApplication
{
//private const string DownloadFolder = "Downloads";
private const string SettingsFile = "settings.json";
private readonly ILogger<DataDownloadApplication> _logger;
private readonly FarmmapsApiService _farmmapsApiService;
private readonly DataDownloadService _dataDownloadService;
private readonly GeneralService _generalService;
private Settings _settings;
public DataDownloadApplication(ILogger<DataDownloadApplication> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService, DataDownloadService dataDownloadService)
{
_logger = logger;
_farmmapsApiService = farmmapsApiService;
_generalService = generalService;
_dataDownloadService = dataDownloadService;
}
public async Task RunAsync()
{
var fieldsInputJson = File.ReadAllText("DataDownloadInput.json");
List<DataDownloadInput> fieldsInputs = JsonConvert.DeserializeObject<List<DataDownloadInput>>(fieldsInputJson);
// !! 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 fieldsInputs)
{
try
{
await Process(roots, input);
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
}
}
}
private async Task Process(List<UserRoot> roots, DataDownloadInput input)
{
string downloadFolder = input.DownloadFolder;
if (string.IsNullOrEmpty(downloadFolder)) {
downloadFolder = "Downloads";
}
if (!Directory.Exists(downloadFolder))
Directory.CreateDirectory(downloadFolder);
// !!specify if you are using an already created cropfield:
bool useCreatedCropfield = input.UseCreatedCropfield;
var cropYear = input.CropYear;
var fieldName = input.fieldName;
bool storeSatelliteStatistics = input.StoreSatelliteStatisticsSingleImage;
bool storeSatelliteStatisticsCropYear = input.StoreSatelliteStatisticsCropYear;
List<string> SatelliteBands = new List<string>(1) { input.SatelliteBand };
string headerLineStats = $"FieldName,satelliteDate,satelliteBand,max,min,mean,mode,median,stddev,minPlus,curtosis,maxMinus,skewness,variance,populationCount,variationCoefficient,confidenceIntervalLow, confidenceIntervalHigh,confidenceIntervalErrorMargin" + Environment.NewLine;
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,
$"DataCropfield {input.OutputFileName}", cropYear, 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);
}
// Get shadow data
if (input.GetShadowData)
{
_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"));
}
// Get satellite data
if (input.GetSatelliteData)
{
// 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 all satellite items
List<Item> satelliteItemsCropYear = await _generalService.FindSatelliteItems(cropfieldItem, _settings.SatelliteTaskCode);
satelliteItemsCropYear = satelliteItemsCropYear.OrderBy(x => x.DataDate).ToList();
if (input.StoreSatelliteStatisticsSingleImage == true) {
_logger.LogInformation("Available satellite images:");
var count = 0;
TimeSpan.FromSeconds(0.5);
foreach (var item in satelliteItemsCropYear)
{
Console.WriteLine($"Satellite image #{count}: {item.DataDate}");
count++;
}
_logger.LogInformation("Enter satellite image number");
int element = Int32.Parse(Console.ReadLine());
var selectedSatelliteItem = satelliteItemsCropYear[element];
var SatelliteDate = selectedSatelliteItem.DataDate.Value.ToString("yyyyMMdd");
string fileName = string.Format($"satelliteGeotiff_{fieldName}_{SatelliteDate}"); // no need to add satelliteBand in the name because the tif contains all bands
string fileNameZip = string.Format($"{fileName}.zip");
string fileNameGeotiff = string.Format($"{fileName}.tif");
await _farmmapsApiService.DownloadItemAsync(selectedSatelliteItem.Code, Path.Combine(downloadFolder, fileNameZip));
// Download a csv file with stats
List<Item> selectedSatalliteItems = new List<Item>(1) { selectedSatelliteItem };
string fileNameStats = Path.Combine(downloadFolder, string.Format($"satelliteStats_{fieldName}_{SatelliteDate}.csv"));
string downloadedStats = await _generalService.DownloadSatelliteStats(selectedSatalliteItems, fieldName, SatelliteBands, downloadFolder);
//rename the csv file with stats
File.Delete(fileNameStats);
File.Move(downloadedStats, fileNameStats);
// wenr.tif. Contains 5 layers: (1) ndvi, (2) wdvi, (3) Red, (4) Green and (5) Blue
// download the geotiffs. Returns a zip file with always these three files:
// data.dat.aux.xml
// thumbnail.jpg
// wenr.tif. Contains 5 layers: (1) ndvi, (2) wdvi, (3) Red, (4) Green and (5) Blue
if (true)
{
// Extract the file "wenr.tif" from zip, rename it to fileNameGeotiff
ZipFile.ExtractToDirectory(Path.Combine(downloadFolder, fileNameZip), downloadFolder, true);
File.Delete(Path.Combine(downloadFolder, fileNameGeotiff)); // Delete the fileNameGeotiff file if exists
File.Move(Path.Combine(downloadFolder, "wenr.tif"), Path.Combine(downloadFolder, fileNameGeotiff)); // Rename the oldFileName into newFileName
// Cleanup
string[] filesToDelete = new string[] { fileNameZip, "wenr.tif", "thumbnail.jpg", "data.dat.aux.xml" };
foreach (string f in filesToDelete)
{
File.Delete(Path.Combine(downloadFolder, f));
}
}
_logger.LogInformation($"Downloaded files {fileNameGeotiff} and {fileNameStats} to {downloadFolder}");
}
if (input.StoreSatelliteStatisticsCropYear == true) {
string fileNameStats = Path.Combine(downloadFolder, string.Format($"satelliteStats_{fieldName}_{cropYear}.csv"));
File.Delete(fileNameStats);
string downloadedStats = await _generalService.DownloadSatelliteStats(satelliteItemsCropYear, fieldName, SatelliteBands, downloadFolder);
File.Move(downloadedStats, fileNameStats);
_logger.LogInformation($"Downloaded file {fileNameStats} with stats for field '{fieldName}', cropyear {cropYear}");
}
}
// Get vanDerSat data
if (input.GetVanDerSatData)
{
// check if satellite 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 satellite item from satelliteTask
Item vanDerSatItem = await _generalService.FindVanDerSatItem(cropfieldItem, _settings.VanDerSatTaskCode, fieldName, input.StoreVanDerSatStatistics);
}
}
// Functions to save previously created cropfields
private void LoadSettings(string file)
{
if (File.Exists(file))
{
var jsonText = File.ReadAllText(file);
_settings = JsonConvert.DeserializeObject<Settings>(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);
}
}
}

View File

@ -0,0 +1,32 @@
[
{
"UseCreatedCropfield": true,
"outputFileName": "testSatData2",
"fieldName": "test_satData2",
"DownloadFolder": "C:\\workdir\\groenmonitor\\", //"C:\\workdir\\groenmonitor\\", // "Downloads", -> if you just put "Downloads" the program will download to somewhere in ..\FarmMapsApiClient_WURtest\FarmmapsDataDownload\bin\Debug\netcoreapp3.1\Downloads\
"GetShadowData": false,
"GetSatelliteData": true,
"SatelliteBand": "wdvi", // "natural", "ndvi" or "wdvi"
"StoreSatelliteStatisticsSingleImage": true,
"StoreSatelliteStatisticsCropYear": true,
"GetVanDerSatData": false,
"StoreVanDerSatStatistics": false,
"CropYear": 2020,
"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 ]
]
]
}
}
]

View File

@ -0,0 +1,29 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using FarmmapsApi.Models;
using FarmmapsApi.Services;
using FarmmapsDataDownload.Models;
using Microsoft.Extensions.Logging;
using static FarmmapsApi.Extensions;
using static FarmmapsApiSamples.Constants;
namespace FarmmapsDataDownload
{
public class DataDownloadService
{
private readonly ILogger<DataDownloadService> _logger;
private readonly FarmmapsApiService _farmmapsApiService;
private readonly GeneralService _generalService;
public DataDownloadService(ILogger<DataDownloadService> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService)
{
_logger = logger;
_farmmapsApiService = farmmapsApiService;
_generalService = generalService;
}
}
}

View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Update="Data\**\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DataDownloadInput.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="InputData-NBS.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FarmmapsApi\FarmmapsApi.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,28 @@
using System;
using Newtonsoft.Json.Linq;
namespace FarmmapsDataDownload.Models
{
public class DataDownloadInput
{
public bool UseCreatedCropfield { get; set; }
public string File { get; set; }
public string InputVariable { get; set; }
public string OutputFileName { get; set; }
public string DownloadFolder { get; set; }
public int CropYear { get; set; }
public JObject GeometryJson { get; set; }
public string InputLayerName { get; set; }
public string fieldName { get; set; }
public bool GetSatelliteData { get; set; }
public bool GetVanDerSatData { get; set; }
public string SatelliteBand { get; set; }
public bool StoreSatelliteStatisticsSingleImage { get; set; }
public bool StoreSatelliteStatisticsCropYear { get; set; }
public bool StoreVanDerSatStatistics { get; set; }
public bool GetShadowData { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace FarmmapsDataDownload
{
public class Settings
{
public string CropfieldItemCode { get; set; }
public string SatelliteTaskCode { get; set; }
public string VanDerSatTaskCode { get; set; }
public string WatBalTaskCode { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace FarmmapsDataDownload.Models
{
public class TargetNData
{
public double TSum { get; set; }
public int TargetYield { get; set; }
public double TargetN { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using System.Threading.Tasks;
using FarmmapsApi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FarmmapsDataDownload
{
class Program : FarmmapsProgram<DataDownloadApplication>
{
private static async Task Main(string[] args)
{
await new Program().Start(args);
}
protected override void Configure(IServiceCollection serviceCollection)
{
serviceCollection.AddLogging()
.AddTransient<DataDownloadService>();
}
}
}

View File

@ -1,3 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@ -1,819 +0,0 @@
{
"type": "FeatureCollection",
"name": "Scan_1_20190605",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4111546, 50.6406962 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.411151, 50.6406838 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4111456, 50.6406706 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4111371, 50.6406588 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4111243, 50.6406488 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4111111, 50.6406409 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4110933, 50.640633 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411066, 50.6406243 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4110331, 50.6406135 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4109925, 50.640599 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4109546, 50.6405849 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4109156, 50.6405696 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4108766, 50.6405543 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4108366, 50.6405393 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.410795, 50.6405224 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410755, 50.6405059 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4107166, 50.6404895 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4106803, 50.6404725 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4106436, 50.6404562 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4106086, 50.640439 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4105746, 50.64042 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4105415, 50.6404011 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4105085, 50.6403818 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4104761, 50.6403628 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4104435, 50.6403418 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4104118, 50.6403205 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4103781, 50.640299 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4103436, 50.6402766 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4103111, 50.6402551 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4102795, 50.6402326 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102485, 50.6402087 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4102186, 50.6401853 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4101898, 50.6401623 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4101588, 50.6401392 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4101291, 50.6401161 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4100998, 50.640092 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4100715, 50.640068 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4100458, 50.6400443 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4100213, 50.6400205 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4099976, 50.6399958 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409975, 50.6399706 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4099525, 50.6399454 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4099303, 50.6399205 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4099063, 50.6398954 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4098826, 50.6398705 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4098586, 50.639845 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4098345, 50.6398194 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4098135, 50.6397931 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4097948, 50.6397667 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4097768, 50.6397403 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.409758, 50.6397135 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4097386, 50.6396868 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.40972, 50.6396595 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4097015, 50.6396328 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4096806, 50.639603 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4096585, 50.6395711 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4096363, 50.6395391 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4096158, 50.6395081 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.409594, 50.639477 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4095721, 50.6394458 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4095503, 50.6394157 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4095271, 50.6393867 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.409503, 50.6393579 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4094768, 50.63933 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4094523, 50.6393026 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4094266, 50.639276 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4094006, 50.6392503 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4093726, 50.6392254 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4093451, 50.6392005 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4093161, 50.6391757 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4092858, 50.6391511 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4092555, 50.6391281 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4092253, 50.6391057 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4091955, 50.6390844 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4091661, 50.639067 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4091386, 50.6390513 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.409112, 50.6390361 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4090885, 50.6390235 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.409075, 50.6390138 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4090683, 50.6390033 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4090598, 50.6389923 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4090576, 50.6389797 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4090626, 50.6389676 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409074, 50.6389562 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4090913, 50.6389443 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4091086, 50.6389323 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4091308, 50.6389218 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4091573, 50.6389104 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4091888, 50.638896 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4092273, 50.6388768 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4092675, 50.6388575 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4093085, 50.6388381 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4093486, 50.6388193 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4093895, 50.6388004 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4094286, 50.6387822 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4094698, 50.6387639 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4095108, 50.638745 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4095525, 50.6387256 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4095948, 50.6387066 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4096373, 50.6386874 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4096791, 50.638668 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.409721, 50.6386485 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4097631, 50.6386295 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4098056, 50.6386101 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409848, 50.6385913 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4098863, 50.6385746 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4099128, 50.6385614 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4099361, 50.6385498 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4099586, 50.638537 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4099801, 50.6385231 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4099976, 50.6385067 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4100133, 50.6384872 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4100311, 50.6384641 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410052, 50.6384362 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4100723, 50.6384077 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4100925, 50.638379 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4101123, 50.6383499 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4101308, 50.6383206 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4101495, 50.6382915 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4101671, 50.6382624 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4101841, 50.6382328 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102005, 50.6382045 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4102163, 50.6381765 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4102331, 50.6381474 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102498, 50.6381186 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4102645, 50.6380897 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102766, 50.6380604 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102883, 50.6380318 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102893, 50.638013 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102928, 50.637991 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410295, 50.6379673 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4102968, 50.6379444 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102988, 50.6379221 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4103006, 50.6378975 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4103021, 50.6378707 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4103043, 50.6378434 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4103058, 50.637816 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4103063, 50.63779 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410306, 50.6377644 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4103063, 50.6377405 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4103063, 50.6377181 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4103066, 50.6376998 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4103091, 50.6376854 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4103145, 50.6376744 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.410323, 50.6376621 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4103333, 50.6376528 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4103476, 50.6376447 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4103622, 50.6376379 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4103811, 50.6376346 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4104041, 50.6376355 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4104426, 50.6376351 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4104735, 50.6376366 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4105143, 50.6376366 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.410563, 50.6376366 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.410614, 50.6376365 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4106651, 50.637636 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4107141, 50.6376351 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4107636, 50.6376349 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.410814, 50.6376345 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4108653, 50.6376345 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.410916, 50.6376349 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4109668, 50.6376354 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4110163, 50.6376354 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4110671, 50.6376346 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.41112, 50.6376345 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4111715, 50.6376345 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4112225, 50.6376345 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4112741, 50.6376349 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4113266, 50.6376353 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4113795, 50.6376354 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4114321, 50.6376362 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4114856, 50.637636 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.411539, 50.6376353 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4115923, 50.637634 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4116445, 50.6376328 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.411697, 50.6376316 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4117496, 50.637631 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4118018, 50.637631 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.411854, 50.6376305 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4119065, 50.6376303 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4119586, 50.6376294 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.412011, 50.6376288 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4120635, 50.6376281 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4121166, 50.6376278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4121698, 50.6376278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4122238, 50.6376278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4122775, 50.637628 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4123308, 50.637628 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4123841, 50.6376278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4124768, 50.6376269 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4124768, 50.6376269 ] } },
{ "type": "Feature", "properties": { "IRMI": 20.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4125145, 50.6376264 ] } },
{ "type": "Feature", "properties": { "IRMI": 20.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4125453, 50.637626 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.9 }, "geometry": { "type": "Point", "coordinates": [ 3.412571, 50.6376285 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4125931, 50.6376333 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.412611, 50.6376379 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4126271, 50.6376438 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4126305, 50.6376488 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4126371, 50.6376553 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4126405, 50.637681 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4126405, 50.637681 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.41264, 50.6376986 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4126338, 50.6377393 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4126338, 50.6377393 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4126273, 50.6377618 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4126216, 50.6377845 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4126146, 50.6378066 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4125961, 50.6378513 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4125961, 50.6378513 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4125863, 50.6378732 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.412567, 50.6379186 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.412567, 50.6379186 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4125458, 50.6379625 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4125458, 50.6379625 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4125333, 50.6379848 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4125095, 50.638032 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4125095, 50.638032 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4124848, 50.6380835 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4124703, 50.63811 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4124703, 50.63811 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.41244, 50.6381631 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.41244, 50.6381631 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4124066, 50.6382166 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4123896, 50.6382445 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4123896, 50.6382445 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4123585, 50.6382991 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4123585, 50.6382991 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.412324, 50.638355 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4123063, 50.638383 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4123063, 50.638383 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122726, 50.638439 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4122558, 50.6384667 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122393, 50.6384959 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122233, 50.6385249 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4122233, 50.6385249 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4121921, 50.6385828 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4121766, 50.638612 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4121615, 50.6386415 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4121448, 50.6386704 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4121283, 50.6387001 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4121126, 50.6387299 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4120968, 50.6387595 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4120968, 50.6387595 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4120651, 50.6388205 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4120478, 50.6388518 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4120316, 50.6388835 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4120153, 50.6389142 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4119993, 50.638946 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4119846, 50.638978 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.41197, 50.6390101 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4119536, 50.6390421 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4119385, 50.6390746 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4119223, 50.639107 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4119056, 50.63914 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4118905, 50.6391735 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4118771, 50.639206 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4118611, 50.6392382 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4118421, 50.6392713 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4118246, 50.6393031 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4118083, 50.6393332 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411793, 50.639364 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4117775, 50.6393948 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4117626, 50.6394254 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4117461, 50.6394559 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4117288, 50.6394861 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4117118, 50.6395158 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4116956, 50.639546 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4116801, 50.6395769 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4116643, 50.6396076 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4116485, 50.6396383 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411633, 50.6396692 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4116173, 50.6397001 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4116011, 50.6397314 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4115861, 50.6397629 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4115688, 50.6397933 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4115528, 50.639824 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.411535, 50.6398535 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411518, 50.6398836 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4115021, 50.639914 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4114861, 50.6399442 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411469, 50.6399738 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4114523, 50.640003 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4114358, 50.6400329 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4114193, 50.640063 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4114036, 50.640093 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4113883, 50.640123 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411373, 50.6401531 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4113578, 50.6401828 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411343, 50.6402126 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4113291, 50.6402402 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4113161, 50.640265 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4113061, 50.6402856 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4112988, 50.6403051 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4112906, 50.6403245 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4112835, 50.6403429 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4112741, 50.64036 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4112588, 50.6403727 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4112383, 50.6403819 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4112158, 50.6403891 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4111871, 50.6403933 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4111535, 50.6403956 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4111115, 50.640396 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4110555, 50.6403958 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4109896, 50.6403956 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4109241, 50.6403956 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4108603, 50.6403968 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4108, 50.640398 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4107433, 50.640399 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.410695, 50.6403998 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.41065, 50.6404006 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4106115, 50.6404006 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4105781, 50.6403993 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.41055, 50.640394 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4105255, 50.6403844 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4105031, 50.6403743 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4104798, 50.6403615 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4104565, 50.6403463 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4104318, 50.64033 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4104048, 50.6403125 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4103763, 50.640293 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4103461, 50.640273 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.410317, 50.6402541 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102896, 50.6402341 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102651, 50.6402138 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4102378, 50.6401935 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4102103, 50.640175 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4101855, 50.6401573 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4101655, 50.6401429 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4101511, 50.6401307 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4101405, 50.6401178 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4101373, 50.6401052 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4101358, 50.6400928 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.410139, 50.6400801 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.410147, 50.6400681 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4101591, 50.6400588 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4101748, 50.640054 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410192, 50.6400487 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102131, 50.6400436 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102396, 50.6400406 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102785, 50.6400383 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410329, 50.6400378 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4103935, 50.6400376 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4104648, 50.6400371 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4105336, 50.640037 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4105991, 50.6400365 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4106634, 50.6400359 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4107288, 50.6400359 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4107953, 50.6400351 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.410861, 50.640034 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4109273, 50.6400333 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4109953, 50.6400328 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411063, 50.640032 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4111305, 50.6400316 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411197, 50.6400308 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4112546, 50.6400303 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4113016, 50.6400304 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4113385, 50.6400298 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4113685, 50.6400268 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4113921, 50.6400225 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.41141, 50.6400138 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4114235, 50.6400037 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4114366, 50.6399925 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4114473, 50.6399787 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4114588, 50.6399605 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4114733, 50.6399365 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4114888, 50.6399086 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4115045, 50.6398803 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115188, 50.6398523 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115336, 50.6398253 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4115468, 50.6398011 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4115583, 50.6397796 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4115653, 50.63976 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4115663, 50.6397435 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115656, 50.6397281 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4115601, 50.6397162 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.411549, 50.6397051 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115345, 50.6396945 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4115156, 50.6396905 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4114958, 50.6396903 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4114761, 50.6396895 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4114526, 50.6396893 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4114193, 50.6396899 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411375, 50.63969 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4113195, 50.6396903 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4112598, 50.6396907 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4112033, 50.6396911 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411146, 50.6396915 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.411085, 50.6396916 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4110203, 50.6396923 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4109531, 50.6396928 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4108826, 50.6396933 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4108121, 50.6396942 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4107438, 50.639694 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4106751, 50.639693 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4106065, 50.6396918 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4105396, 50.6396907 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4104718, 50.6396905 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4104013, 50.6396903 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4103308, 50.6396903 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102605, 50.6396905 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.41019, 50.639691 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4101198, 50.6396915 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4100513, 50.6396911 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4099921, 50.6396907 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4099395, 50.6396907 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4098941, 50.639691 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.409855, 50.6396915 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4098208, 50.6396915 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4097925, 50.6396887 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4097696, 50.6396852 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4097505, 50.6396776 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.409736, 50.6396666 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.409722, 50.6396547 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.409707, 50.6396377 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4096915, 50.6396145 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4096731, 50.6395871 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4096533, 50.639558 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4096346, 50.6395298 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4096161, 50.6395018 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4095975, 50.6394758 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4095785, 50.6394529 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409564, 50.6394328 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.409557, 50.6394139 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.409558, 50.6393969 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4095651, 50.6393804 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4095765, 50.6393676 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.409593, 50.6393585 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4096136, 50.6393532 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.409639, 50.6393498 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4096715, 50.6393468 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4097088, 50.639344 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4097626, 50.6393422 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.409831, 50.6393413 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4099031, 50.6393408 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409973, 50.6393403 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4100393, 50.6393388 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4101025, 50.6393378 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4101683, 50.6393366 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102341, 50.639336 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4103003, 50.6393353 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410368, 50.6393343 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4104356, 50.6393342 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4105036, 50.6393342 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4105721, 50.639334 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.41064, 50.639334 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4107093, 50.6393337 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410779, 50.6393336 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4108486, 50.6393332 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.410919, 50.6393319 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4109895, 50.6393306 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4110595, 50.6393298 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4111295, 50.6393291 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4112001, 50.6393288 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4112695, 50.6393282 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411339, 50.6393275 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4114083, 50.6393258 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4114783, 50.6393252 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4115471, 50.6393251 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4116061, 50.6393248 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4116565, 50.6393252 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4117003, 50.6393255 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411736, 50.6393245 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4117633, 50.6393208 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4117875, 50.6393155 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118061, 50.6393075 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4118178, 50.6392965 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118266, 50.6392841 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118385, 50.6392655 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4118523, 50.63924 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4118651, 50.639212 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411878, 50.6391833 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118921, 50.6391535 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4119081, 50.6391248 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411924, 50.6390981 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4119363, 50.6390758 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4119451, 50.6390568 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4119475, 50.6390399 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4119436, 50.6390258 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.411939, 50.6390136 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411933, 50.639005 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.411924, 50.6389949 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.411912, 50.6389877 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411897, 50.6389815 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4118751, 50.638984 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4118505, 50.6389835 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4118223, 50.6389838 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4117868, 50.6389834 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4117445, 50.6389831 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.411692, 50.6389826 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4116335, 50.6389828 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411571, 50.6389826 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4115043, 50.6389821 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4114395, 50.6389816 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4113735, 50.638981 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4113076, 50.6389813 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4112413, 50.6389813 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4111735, 50.6389813 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411106, 50.6389813 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4110375, 50.6389815 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.410968, 50.638982 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4108995, 50.638982 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4108321, 50.638982 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4107641, 50.638982 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4106953, 50.6389821 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4106271, 50.6389821 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4105588, 50.6389825 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4104913, 50.6389821 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4104236, 50.6389822 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4103563, 50.6389828 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102893, 50.6389822 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102218, 50.6389825 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4101546, 50.6389838 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4100885, 50.6389843 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4100216, 50.6389851 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4099555, 50.6389851 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.409889, 50.6389852 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4098226, 50.6389859 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4097568, 50.6389865 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4096915, 50.6389872 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4096256, 50.6389888 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4095601, 50.63899 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4094958, 50.6389907 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4094338, 50.638991 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4093826, 50.6389914 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4093416, 50.6389919 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4093033, 50.638992 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4092668, 50.6389916 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4092363, 50.6389895 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4092113, 50.6389843 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4091941, 50.6389755 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4091821, 50.6389659 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4091745, 50.6389566 ] } },
{ "type": "Feature", "properties": { "IRMI": 17.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4091675, 50.6389468 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4091643, 50.638936 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4091663, 50.638925 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.409174, 50.6389135 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.409181, 50.6389018 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4091924, 50.6388915 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4092091, 50.6388813 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4092306, 50.63887 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4092623, 50.6388552 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4092971, 50.6388398 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409332, 50.6388233 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4093696, 50.6388051 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4094058, 50.638787 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4094431, 50.63877 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4094803, 50.6387533 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4095171, 50.6387353 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.409555, 50.6387176 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.409593, 50.6387006 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.409632, 50.6386836 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4096698, 50.6386663 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4097081, 50.6386495 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4097458, 50.6386366 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4097848, 50.6386277 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4098251, 50.6386251 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4098676, 50.6386246 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.409914, 50.6386246 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4099621, 50.638625 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4100151, 50.6386254 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410071, 50.638626 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4101288, 50.6386259 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4101883, 50.6386259 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4102481, 50.6386263 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4103091, 50.6386265 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4103685, 50.6386259 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4104288, 50.6386254 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4104898, 50.6386256 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4105513, 50.6386254 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4106123, 50.6386256 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4106753, 50.6386256 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.410743, 50.6386259 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4108153, 50.6386254 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4108886, 50.6386253 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.410962, 50.6386245 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4110366, 50.6386242 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.41111, 50.6386246 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4111833, 50.6386247 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4112571, 50.6386253 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4113301, 50.6386253 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4114026, 50.6386253 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4114742, 50.6386251 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411545, 50.6386251 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4116143, 50.638624 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4116841, 50.6386226 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4117518, 50.6386217 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118171, 50.6386216 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4118811, 50.6386212 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4119338, 50.6386212 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4119826, 50.6386212 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.412025, 50.6386205 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4120606, 50.6386203 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4120903, 50.6386199 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4121131, 50.6386165 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4121306, 50.6386119 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4121433, 50.6386047 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4121561, 50.6385966 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4121683, 50.6385858 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4121793, 50.6385719 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4121916, 50.6385524 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4122025, 50.63853 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4122145, 50.6385071 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4122276, 50.6384835 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122405, 50.6384605 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4122526, 50.638438 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122661, 50.6384146 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.412281, 50.6383925 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122956, 50.638371 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4123063, 50.6383516 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4123091, 50.6383322 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4123076, 50.638314 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4123008, 50.6382977 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4122876, 50.6382867 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4122668, 50.638281 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.412242, 50.638279 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4122166, 50.6382775 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4121906, 50.6382766 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4121575, 50.638276 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4121163, 50.6382748 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4120648, 50.6382739 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4120093, 50.6382736 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4119521, 50.6382738 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4118911, 50.6382745 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4118294, 50.638275 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4117696, 50.6382755 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4117078, 50.6382755 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4116466, 50.6382761 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4115833, 50.6382773 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411519, 50.6382786 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4114556, 50.6382796 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4113921, 50.63828 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4113276, 50.6382798 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411265, 50.6382793 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411203, 50.6382791 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4111415, 50.6382794 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4110803, 50.6382805 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4110198, 50.6382807 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.41096, 50.6382811 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4109001, 50.6382815 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4108408, 50.6382823 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.410782, 50.6382829 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4107233, 50.6382837 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4106645, 50.6382853 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410606, 50.6382865 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4105488, 50.6382867 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4104921, 50.6382866 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4104366, 50.6382866 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4103876, 50.6382873 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4103431, 50.638289 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4103048, 50.6382896 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.410269, 50.6382872 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4102398, 50.6382805 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4102208, 50.6382702 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4102085, 50.6382599 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102003, 50.6382493 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4101958, 50.6382361 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4101981, 50.6382222 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102035, 50.6382085 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102097, 50.6381918 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4102175, 50.6381737 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102278, 50.6381528 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102383, 50.638131 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.410249, 50.6381095 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4102593, 50.6380872 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.410268, 50.6380656 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4102766, 50.6380452 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4102843, 50.6380252 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4102915, 50.6380045 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410297, 50.637986 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4103051, 50.6379693 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4103186, 50.6379535 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4103383, 50.6379413 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4103648, 50.6379355 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4103953, 50.637932 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4104315, 50.63793 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4104735, 50.637929 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4105171, 50.6379296 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4105608, 50.6379295 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4106065, 50.6379292 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4106545, 50.6379291 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4107066, 50.6379285 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410759, 50.6379278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4108115, 50.6379276 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4108666, 50.6379273 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.410921, 50.6379276 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4109755, 50.6379278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4110305, 50.6379278 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4110883, 50.6379273 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4111476, 50.6379266 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4112113, 50.637926 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4112745, 50.6379266 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411337, 50.6379266 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4114006, 50.6379262 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4114648, 50.6379255 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4115293, 50.6379254 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4115948, 50.637925 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4116596, 50.6379242 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411724, 50.637923 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.411789, 50.6379216 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.411853, 50.6379205 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4119165, 50.6379194 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4119783, 50.6379185 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4120401, 50.6379181 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4120996, 50.6379182 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4121555, 50.6379191 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.412202, 50.6379198 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.412246, 50.6379191 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4122906, 50.6379181 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4123321, 50.637917 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.412366, 50.6379163 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4123945, 50.637916 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4124138, 50.6379156 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4124283, 50.637916 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.412444, 50.6379175 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4124638, 50.6379223 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4124856, 50.6379296 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.412505, 50.6379373 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4125193, 50.6379462 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4125258, 50.6379581 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.412528, 50.637972 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4125265, 50.637988 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4125205, 50.6380063 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4125115, 50.63803 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.412497, 50.6380568 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4124806, 50.6380859 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4124643, 50.6381152 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.412448, 50.6381437 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4124321, 50.6381728 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.6 }, "geometry": { "type": "Point", "coordinates": [ 3.4124155, 50.6382009 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4123988, 50.63823 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4123831, 50.6382587 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4123656, 50.638287 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4123483, 50.6383158 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4123308, 50.6383444 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4123128, 50.6383735 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4122951, 50.6384027 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122776, 50.6384318 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122603, 50.6384605 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4122431, 50.6384896 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122271, 50.6385183 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4122106, 50.6385466 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4121948, 50.6385754 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4121793, 50.638604 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.412165, 50.638633 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4121508, 50.6386611 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.412136, 50.6386892 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4121196, 50.6387183 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4121036, 50.6387485 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4120875, 50.6387788 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.412071, 50.6388098 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4120541, 50.6388405 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4120381, 50.638872 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4120226, 50.6389035 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4119935, 50.6389668 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4119935, 50.6389668 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411979, 50.6389983 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4119643, 50.6390297 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4119496, 50.639061 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4119181, 50.639122 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.4119181, 50.639122 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118868, 50.6391833 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4118713, 50.6392136 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4118713, 50.6392136 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4118388, 50.6392735 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.411824, 50.639303 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4118088, 50.639333 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4117938, 50.6393631 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411778, 50.6393926 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4117625, 50.6394218 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4117473, 50.639451 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4117306, 50.6394818 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.4117128, 50.6395119 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4116953, 50.6395428 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4116793, 50.6395743 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4116631, 50.6396053 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4116468, 50.6396365 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4116305, 50.639668 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.6 }, "geometry": { "type": "Point", "coordinates": [ 3.411614, 50.6396985 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115963, 50.63973 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115783, 50.6397611 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.411561, 50.639792 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.2 }, "geometry": { "type": "Point", "coordinates": [ 3.4115445, 50.639823 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411528, 50.6398538 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4115101, 50.639887 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4114925, 50.6399192 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4114755, 50.6399511 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4114586, 50.639983 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4114425, 50.6400152 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4114261, 50.6400478 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4114095, 50.6400806 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4113923, 50.6401128 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.411376, 50.6401453 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4113588, 50.6401773 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4113421, 50.6402099 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4113255, 50.640243 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.1 }, "geometry": { "type": "Point", "coordinates": [ 3.411309, 50.6402758 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4112953, 50.6403081 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4112821, 50.6403411 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4112683, 50.6403743 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4112541, 50.6404071 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4112426, 50.6404395 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.41123, 50.6404736 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.8 }, "geometry": { "type": "Point", "coordinates": [ 3.4112198, 50.6405063 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4112111, 50.6405385 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4112028, 50.6405687 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.0 }, "geometry": { "type": "Point", "coordinates": [ 3.4111971, 50.6405928 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.4111928, 50.6406145 ] } },
{ "type": "Feature", "properties": { "IRMI": 18.9 }, "geometry": { "type": "Point", "coordinates": [ 3.411189, 50.6406321 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.4 }, "geometry": { "type": "Point", "coordinates": [ 3.4111843, 50.6406476 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.5 }, "geometry": { "type": "Point", "coordinates": [ 3.41118, 50.6406615 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.7 }, "geometry": { "type": "Point", "coordinates": [ 3.4111751, 50.6406735 ] } },
{ "type": "Feature", "properties": { "IRMI": 19.3 }, "geometry": { "type": "Point", "coordinates": [ 3.4111692, 50.6406854 ] } }
]
}

Binary file not shown.

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -12,6 +12,9 @@
<None Update="NitrogenInput.json"> <None Update="NitrogenInput.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="InputData-NBS.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -5,6 +5,7 @@ namespace FarmmapsNbs.Models
{ {
public class NitrogenInput public class NitrogenInput
{ {
public bool UseCreatedCropfield { get; set; }
public string File { get; set; } public string File { get; set; }
public string InputVariable { get; set; } public string InputVariable { get; set; }
public string OutputFileName { get; set; } public string OutputFileName { get; set; }
@ -13,5 +14,21 @@ namespace FarmmapsNbs.Models
public string PotatoPurposeType { get; set; } public string PotatoPurposeType { get; set; }
public int TargetYield { get; set; } public int TargetYield { get; set; }
public JObject GeometryJson { 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 OutputType { get; set; }
public string DdiCode { get; set; }
public string CellWidth { get; set; }
public string CellHeight { get; set; }
public string Centered { get; set; }
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; }
} }
} }

View File

@ -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; }
}
}

View File

@ -9,6 +9,7 @@ using FarmmapsApi.Services;
using FarmmapsNbs.Models; using FarmmapsNbs.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using static FarmmapsApiSamples.Constants; using static FarmmapsApiSamples.Constants;
namespace FarmmapsNbs namespace FarmmapsNbs
@ -16,12 +17,15 @@ namespace FarmmapsNbs
public class NbsApplication : IApplication public class NbsApplication : IApplication
{ {
private const string DownloadFolder = "Downloads"; private const string DownloadFolder = "Downloads";
private const string SettingsFile = "settings.json";
private readonly ILogger<NbsApplication> _logger; private readonly ILogger<NbsApplication> _logger;
private readonly FarmmapsApiService _farmmapsApiService; private readonly FarmmapsApiService _farmmapsApiService;
private readonly NitrogenService _nitrogenService; private readonly NitrogenService _nitrogenService;
private readonly GeneralService _generalService; private readonly GeneralService _generalService;
private Settings _settings;
public NbsApplication(ILogger<NbsApplication> logger, FarmmapsApiService farmmapsApiService, public NbsApplication(ILogger<NbsApplication> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService, NitrogenService nitrogenService) GeneralService generalService, NitrogenService nitrogenService)
{ {
@ -34,7 +38,6 @@ namespace FarmmapsNbs
public async Task RunAsync() public async Task RunAsync()
{ {
var nitrogenInputJson = File.ReadAllText("NitrogenInput.json"); var nitrogenInputJson = File.ReadAllText("NitrogenInput.json");
//var nitrogenInputJson = File.ReadAllText("fivefieldsinput.json");
List<NitrogenInput> nitrogenInputs = JsonConvert.DeserializeObject<List<NitrogenInput>>(nitrogenInputJson); List<NitrogenInput> nitrogenInputs = JsonConvert.DeserializeObject<List<NitrogenInput>>(nitrogenInputJson);
if (!Directory.Exists(DownloadFolder)) if (!Directory.Exists(DownloadFolder))
@ -59,8 +62,16 @@ namespace FarmmapsNbs
private async Task Process(List<UserRoot> roots, NitrogenInput input) private async Task Process(List<UserRoot> roots, NitrogenInput input)
{ {
// !!specify if you are using an already created cropfield:
bool useCreatedCropfield = input.UseCreatedCropfield;
var plantingDate = input.PlantingDate; var plantingDate = input.PlantingDate;
var FieldName = input.fieldName;
bool StoreStatistics = input.storeSatelliteStatistics;
var measurementDate = input.MeasurementDate; var measurementDate = input.MeasurementDate;
string settingsfile = $"Settings_{FieldName}.json";
LoadSettings(settingsfile);
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded"); var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
if (uploadedRoot == null) if (uploadedRoot == null)
@ -76,38 +87,122 @@ namespace FarmmapsNbs
return; return;
} }
var cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code, // 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)); $"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; var geotiffItem = (Item)null;
if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) { // If no input file is specified, 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);
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 SatelliteStatsFile = $"{DownloadFolder}/SatelliteDataStatistics_{FieldName}_{satalliteItem.DataDate.Value:yyyy-MM-dd}.csv";
using var w = new StreamWriter(SatelliteStatsFile);
{
foreach (var item in satelliteStatistics)
{
var line = string.Format("{0}", item);
w.WriteLine(line);
w.Flush();
}
}
}
// 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"); _logger.LogInformation("input = tiff data");
var dataPath = Path.Combine("Data", input.File); var dataPath = Path.Combine("Data", input.File);
geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath, geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath,
Path.GetFileNameWithoutExtension(input.File)); Path.GetFileNameWithoutExtension(input.File));
if (geotiffItem == null) { if (geotiffItem == null)
{
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
} }
else { // json/shape input
else
{
var isGeoJson = input.File.Contains("json"); var isGeoJson = input.File.Contains("json");
var dataPath = Path.Combine("Data", input.File); var dataPath = Path.Combine("Data", input.File);
var shapeItem = isGeoJson ? var shapeItem = isGeoJson ?
await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File)) : await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None)) :
await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File)); await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None));
if (shapeItem == null) { if (shapeItem == null)
{
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
_logger.LogInformation($"Converting shape to geotiff"); _logger.LogInformation($"Converting shape to geotiff");
geotiffItem = await _generalService.ShapeToGeotiff(shapeItem); geotiffItem = await _generalService.ShapeToGeotiff(shapeItem);
if (geotiffItem == null) { if (geotiffItem == null)
{
_logger.LogError("Something went wrong with shape to geotiff transformation"); _logger.LogError("Something went wrong with shape to geotiff transformation");
return; return;
} }
@ -117,6 +212,7 @@ namespace FarmmapsNbs
Path.Combine(DownloadFolder, $"{input.OutputFileName}.input_geotiff.zip")); Path.Combine(DownloadFolder, $"{input.OutputFileName}.input_geotiff.zip"));
} }
_logger.LogInformation($"Calculating targetN with targetYield: {input.TargetYield}"); _logger.LogInformation($"Calculating targetN with targetYield: {input.TargetYield}");
var targetNItem = await _nitrogenService.CreateTargetNItem(cropfieldItem); var targetNItem = await _nitrogenService.CreateTargetNItem(cropfieldItem);
var targetNData = await _nitrogenService.CalculateTargetN(cropfieldItem, targetNItem, plantingDate, var targetNData = await _nitrogenService.CalculateTargetN(cropfieldItem, targetNItem, plantingDate,
@ -134,12 +230,13 @@ namespace FarmmapsNbs
//_logger.LogInformation($"TargetN adjusted: {targetNData.TargetN}"); //_logger.LogInformation($"TargetN adjusted: {targetNData.TargetN}");
var targetNDataPath = Path.Combine(DownloadFolder, $"{input.OutputFileName}.targetn.json"); var targetNDataPath = Path.Combine(DownloadFolder, $"{input.OutputFileName}.targetn.json");
await File.WriteAllTextAsync(targetNDataPath, JsonConvert.SerializeObject(targetNData, Formatting.Indented)); await File.WriteAllTextAsync(targetNDataPath, JsonConvert.SerializeObject(targetNData, Formatting.Indented));
_logger.LogInformation("Calculating uptake map"); _logger.LogInformation("Calculating uptake map");
var uptakeMapItem = var uptakeMapItem =
await _nitrogenService.CalculateUptakeMap(cropfieldItem, geotiffItem, plantingDate, await _nitrogenService.CalculateUptakeMap(cropfieldItem, geotiffItem, plantingDate,
measurementDate, input.InputVariable); measurementDate, input.InputVariable, input.InputLayerName);
if (uptakeMapItem == null) if (uptakeMapItem == null)
{ {
_logger.LogError("Something went wrong with creating the uptakeMap"); _logger.LogError("Something went wrong with creating the uptakeMap");
@ -149,45 +246,110 @@ namespace FarmmapsNbs
_logger.LogInformation("Downloading uptake map"); _logger.LogInformation("Downloading uptake map");
await _farmmapsApiService.DownloadItemAsync(uptakeMapItem.Code, await _farmmapsApiService.DownloadItemAsync(uptakeMapItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.uptake.zip")); Path.Combine(DownloadFolder, $"{input.OutputFileName}.uptake.zip"));
_logger.LogInformation("UptakeMap downloaded to {0}", Path.Combine(DownloadFolder, $"{input.OutputFileName}.uptake.zip")); _logger.LogInformation("UptakeMap downloaded");
_logger.LogInformation("Calculating application map"); _logger.LogInformation("Calculating application map");
var applicationMapItem = var applianceMapItem =
await _nitrogenService.CalculateApplicationMap(cropfieldItem, geotiffItem, plantingDate, await _nitrogenService.CalculateApplicationMap(cropfieldItem, geotiffItem, plantingDate,
measurementDate, measurementDate, input.InputVariable, targetNData.TargetN, input.InputLayerName);
input.InputVariable, targetNData.TargetN);
if (applicationMapItem == null) if (applianceMapItem == null)
{ {
_logger.LogError("Something went wrong with creating the applicationMap"); _logger.LogError("Something went wrong with creating the applicationMap");
return; return;
} }
_logger.LogInformation("Downloading application map"); _logger.LogInformation("Downloading application map");
await _farmmapsApiService.DownloadItemAsync(applicationMapItem.Code, await _farmmapsApiService.DownloadItemAsync(applianceMapItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.application.zip")); Path.Combine(DownloadFolder, $"{input.OutputFileName}.application.zip"));
_logger.LogInformation("Application map can be found in {0}", 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 //transforming tiff to shape
var tiffItem = applicationMapItem; var tiffItem = applianceMapItem;
if (tiffItem == null) if (tiffItem == null)
{ {
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
_logger.LogInformation($"Converting geotiff to shape");
var taskmap = await _generalService.GeotiffToShape(tiffItem); //ApplicationMap (GEOTIFF) To Taskmap
if (input.GenerateTaskmap)
{
//GEOTIFF TO Taskmap
_logger.LogInformation($"Converting geotiff to taskmap");
var taskmap = (Item)null;
if (input.OutputType == "isoxml")
{
if (input.DdiCode == null)
{
_logger.LogInformation("DDi not given. Using expected identifiers");
input.DdiCode = input.DdiCode = "0006";
}
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: 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);
}
if (taskmap == null) if (taskmap == null)
{ {
_logger.LogError("Something went wrong with geotiff to shape transformation"); _logger.LogError("Something went wrong with geotiff to taskmap transformation");
return; return;
} }
_logger.LogInformation("Downloading taskmap"); _logger.LogInformation("Downloading taskmap");
await _farmmapsApiService.DownloadItemAsync(taskmap.Code, await _farmmapsApiService.DownloadItemAsync(taskmap.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.taskmap.zip")); 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<Settings>(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);
}
} }
} }

View File

@ -1,126 +1,111 @@
[ [
//{
// "UseCreatedCropfield": true,
// "file": "Scan_1_20190605.json",
// "inputVariable": "irmi",
// "inputLayerName": "",
// "outputFileName": "vranbs1",
// "fieldName": "testJson_irmi",
// "storeSatelliteStatistics": true,
// "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 ]
// ]
// ]
// },
// "GenerateTaskmap": true,
// "OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode
// "Precision": "2",
// "MaximumClasses": "4",
// "DdiCode": "0006",
// "CellWidth": "3",
// "CellHeight": "10",
// "Centered": "true",
// "StartPoint": {
// "type": "Point",
// "coordinates": [ 3.409341600000000, 50.638991900000001 ]
// },
// "EndPoint": { // if no angle
// "type": "Point",
// "coordinates": [ 3.411897000000000, 50.638981500000000 ]
// }
// //"Angle": "317.0" // if no endpoint
//},
{ {
"file": "Scan_1_20190605.json", "UseCreatedCropfield": false,
"inputVariable": "irmi", "file": "", // keep emptpy to use satellite image
"outputFileName": "vranbs1", "inputVariable": "wdvi",
"plantingDate": "2019-04-18", "InputLayerName": "wdvi",
"measurementDate": "2019-06-05", "outputFileName": "rtest1",
"fieldName": "test_satelliteWDVI",
"storeSatelliteStatistics": true,
"plantingDate": "2020-05-01",
"measurementDate": "2020-06-14",
"potatoPurposeType": "consumption", "potatoPurposeType": "consumption",
"targetYield": 45, "targetYield": 60,
"geometryJson": { "type": "Polygon", "coordinates": [ [ [ 3.40843828875524, 50.638966444680605 ], [ 3.408953272886064, 50.639197789621612 ], [ 3.409242951459603, 50.639469958681836 ], [ 3.409328782148028, 50.639612846807708 ], [ 3.409457528180712, 50.639789755314411 ], [ 3.409639918393741, 50.640014292074966 ], [ 3.409833037442765, 50.640211611372706 ], [ 3.410069071836049, 50.640395321698435 ], [ 3.410380208081761, 50.640572227259661 ], [ 3.410605513638958, 50.640715112034222 ], [ 3.411925160474145, 50.641177783561204 ], [ 3.411935889310142, 50.640728720085136 ], [ 3.412590348309737, 50.63948356709389 ], [ 3.413244807309242, 50.638224772339846 ], [ 3.413400375432099, 50.637901562841307 ], [ 3.413539850300779, 50.637449065809889 ], [ 3.413475477284437, 50.637418445552932 ], [ 3.40999396998362, 50.637449065810451 ], [ 3.409940325803365, 50.638102293212661 ], [ 3.409575545377398, 50.638483338338325 ], [ 3.409060561246574, 50.638707881340494 ], [ 3.40843828875524, 50.638966444680605 ] ] ] }
},
{
"file": "Scan_1_20190605.zip",
"inputVariable": "irmi",
"outputFileName": "vranbs2",
"plantingDate": "2019-04-18",
"measurementDate": "2019-06-05",
"potatoPurposeType": "starch",
"targetYield": 45,
"geometryJson": { "geometryJson": {
"type": "Polygon", "type": "Polygon",
"coordinates": [ "coordinates": [
[ [
[ 3.40843828875524, 50.638966444680605 ], [ 4.960707146896585, 52.800583669708487 ],
[ 3.408953272886064, 50.639197789621612 ], [ 4.960645975538824, 52.800470217610922 ],
[ 3.409242951459603, 50.639469958681836 ], [ 4.962140695752897, 52.799177147194797 ],
[ 3.409328782148028, 50.639612846807708 ], [ 4.967523821195745, 52.801502400041208 ],
[ 3.409457528180712, 50.639789755314411 ], [ 4.966336768950911, 52.802543735879809 ],
[ 3.409639918393741, 50.640014292074966 ], [ 4.961711880764330, 52.801009996856429 ],
[ 3.409833037442765, 50.640211611372706 ], [ 4.960707146896585, 52.800583669708487 ]
[ 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", "GenerateTaskmap": true,
"inputVariable": "irmi", "OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode
"outputFileName": "vranbs3", "Precision": "2",
"plantingDate": "2019-04-18", "MaximumClasses": "4",
"measurementDate": "2019-06-20", "DdiCode": "0006",
"potatoPurposeType": "starch", "CellWidth": "3",
"targetYield": 45, "CellHeight": "10",
"geometryJson": { "Centered": "true",
"type": "Polygon", "StartPoint": {
"coordinates": [ "type": "Point",
[ "coordinates": [ 4.960707146896585, 52.800583669708487 ]
[ 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 ]
]
]
}
}, },
{ "EndPoint": { // if no angle
"file": "Scan_1_20190605.zip", "type": "Point",
"inputVariable": "irmi", "coordinates": [ 4.961711880764330, 52.801009996856429 ]
"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 ]
]
]
} }
//"Angle": "317.0" // if no endpoint
} }
] ]

View File

@ -82,9 +82,11 @@ namespace FarmmapsNbs
/// <param name="inputItem"></param> /// <param name="inputItem"></param>
/// <param name="plantingDate">The date the crop is planted</param> /// <param name="plantingDate">The date the crop is planted</param>
/// <param name="measurementDate">The date the measurements are taken</param> /// <param name="measurementDate">The date the measurements are taken</param>
/// <param name="inputType">Data type, could be yara, ci, irmi or wdvi</param>
/// <param name="inputLayerName">Column name in which the sensor value is stored</param>
/// <returns></returns> /// <returns></returns>
public async Task<Item> CalculateUptakeMap(Item cropfieldItem, Item inputItem, DateTime plantingDate, public async Task<Item> CalculateUptakeMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
DateTime measurementDate, string inputType) DateTime measurementDate, string inputType, string inputLayerName)
{ {
var nbsUptakeMapRequest = new TaskRequest {TaskType = VRANBS_TASK}; var nbsUptakeMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
nbsUptakeMapRequest.attributes["operation"] = "uptake"; nbsUptakeMapRequest.attributes["operation"] = "uptake";
@ -92,10 +94,9 @@ namespace FarmmapsNbs
nbsUptakeMapRequest.attributes["plantingDate"] = plantingDate.ToString("o"); nbsUptakeMapRequest.attributes["plantingDate"] = plantingDate.ToString("o");
nbsUptakeMapRequest.attributes["measurementDate"] = measurementDate.ToString("o"); nbsUptakeMapRequest.attributes["measurementDate"] = measurementDate.ToString("o");
nbsUptakeMapRequest.attributes["inputType"] = inputType.ToLower(); nbsUptakeMapRequest.attributes["inputType"] = inputType.ToLower();
nbsUptakeMapRequest.attributes["inputLayerName"] = "IRMI"; //toevoeging FS. Kolom IRMI hernoemd als IMI. Deze wordt niet automatisch herkend. En moet dus gespecificeerd worden. 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.
//var layers = inputItem.Data["layers"]; //toevoeging FS, check welke data lagen worden omgezet
//_logger.LogInformation($"DataLayers: {layers}"); //toevoeging FS check welke data lagen worden omgezet
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsUptakeMapRequest); string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsUptakeMapRequest);
@ -103,12 +104,13 @@ namespace FarmmapsNbs
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
{ {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Calculating uptake map; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
tokenSource.Cancel(); tokenSource.Cancel();
}); });
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
if(itemTask.State == ItemTaskState.Error) if (itemTask.State == ItemTaskState.Error)
{ {
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}"); _logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
return null; return null;
@ -119,6 +121,7 @@ namespace FarmmapsNbs
GEOTIFF_PROCESSED_ITEMTYPE, itemName, GEOTIFF_PROCESSED_ITEMTYPE, itemName,
i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) && i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) &&
i.Name.ToLower().Contains(itemName.ToLower())); i.Name.ToLower().Contains(itemName.ToLower()));
if (uptakeMapItem == null) if (uptakeMapItem == null)
{ {
_logger.LogError("Could not find the uptake geotiff child item under cropfield"); _logger.LogError("Could not find the uptake geotiff child item under cropfield");
@ -136,11 +139,11 @@ namespace FarmmapsNbs
/// <param name="inputItem">The farmmaps item containing the geotiff data</param> /// <param name="inputItem">The farmmaps item containing the geotiff data</param>
/// <param name="plantingDate">The date the crop is planted</param> /// <param name="plantingDate">The date the crop is planted</param>
/// <param name="measurementDate">The date the measurements are taken</param> /// <param name="measurementDate">The date the measurements are taken</param>
/// <param name="inputType">The inputtype to use</param> /// <param name="inputType">The inputtype to use, could be yara, ci, irmi or wdvi</param>
/// <param name="targetN">The target nitrogen to use for the calculations</param> /// <param name="targetN">The target nitrogen to use for the calculations</param>
/// <returns></returns> /// <returns></returns>
public async Task<Item> CalculateApplicationMap(Item cropfieldItem, Item inputItem, DateTime plantingDate, public async Task<Item> CalculateApplicationMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
DateTime measurementDate, string inputType, double targetN) DateTime measurementDate, string inputType, double targetN, string inputLayerName)
{ {
var nbsApplicationMapRequest = new TaskRequest {TaskType = VRANBS_TASK}; var nbsApplicationMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
nbsApplicationMapRequest.attributes["operation"] = "application"; nbsApplicationMapRequest.attributes["operation"] = "application";
@ -150,13 +153,14 @@ namespace FarmmapsNbs
nbsApplicationMapRequest.attributes["inputCode"] = inputItem.Code; nbsApplicationMapRequest.attributes["inputCode"] = inputItem.Code;
nbsApplicationMapRequest.attributes["inputType"] = inputType.ToLower(); nbsApplicationMapRequest.attributes["inputType"] = inputType.ToLower();
nbsApplicationMapRequest.attributes["targetN"] = targetN.ToString(CultureInfo.InvariantCulture); nbsApplicationMapRequest.attributes["targetN"] = targetN.ToString(CultureInfo.InvariantCulture);
if (!(string.IsNullOrEmpty(inputLayerName))) nbsApplicationMapRequest.attributes["inputLayerName"] = inputLayerName;
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsApplicationMapRequest); string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, nbsApplicationMapRequest);
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
{ {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
_logger.LogInformation($"Calculating application map; status: {itemTaskStatus.State}");
if (itemTaskStatus.IsFinished) if (itemTaskStatus.IsFinished)
tokenSource.Cancel(); tokenSource.Cancel();
}); });

View File

@ -14,9 +14,7 @@ namespace FarmmapsNbs
protected override void Configure(IServiceCollection serviceCollection) protected override void Configure(IServiceCollection serviceCollection)
{ {
serviceCollection.AddLogging(opts => opts serviceCollection.AddLogging()
.AddConsole()
.AddFilter("System.Net.Http", LogLevel.Warning))
.AddTransient<NitrogenService>(); .AddTransient<NitrogenService>();
} }
} }

View File

@ -5,14 +5,29 @@ namespace FarmmapsPoten.Models
{ {
public class PotenInput public class PotenInput
{ {
public bool UseShadow { get; set; }
public string File { get; set; } public string File { get; set; }
public string InputLayerName { get; set; }
public string OutputFileName { get; set; } public string OutputFileName { get; set; }
public string FieldName { get; set; } public string FieldName { get; set; }
public int PlantingYear { get; set; } public int PlantingYear { get; set; }
public string MeanDensity { get; set; } public string MeanDensity { get; set; }
public string Variation { get; set; } public string Variation { get; set; }
public bool UseShadow { get; set; }
public bool CountPerArea { get; set; }
public JObject GeometryJson { get; set; } public JObject GeometryJson { get; set; }
public bool GenerateTaskmap { get; set; }
public string OutputType { get; set; }
public string DdiCode { get; set; }
public string CellWidth { get; set; }
public string CellHeight { get; set; }
public string Centered { get; set; }
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; }
} }
} }

View File

@ -14,9 +14,7 @@ using static FarmmapsApiSamples.Constants;
namespace FarmmapsVRApoten namespace FarmmapsVRApoten
{ {
public class PotenApplication : IApplication public class PotenApplication : IApplication {
{
private const string DownloadFolder = "Downloads"; private const string DownloadFolder = "Downloads";
private readonly ILogger<PotenApplication> _logger; private readonly ILogger<PotenApplication> _logger;
@ -26,16 +24,14 @@ namespace FarmmapsVRApoten
public PotenApplication(ILogger<PotenApplication> logger, FarmmapsApiService farmmapsApiService, public PotenApplication(ILogger<PotenApplication> logger, FarmmapsApiService farmmapsApiService,
GeneralService generalService, PotenService potenService) GeneralService generalService, PotenService potenService) {
{
_logger = logger; _logger = logger;
_farmmapsApiService = farmmapsApiService; _farmmapsApiService = farmmapsApiService;
_generalService = generalService; _generalService = generalService;
_potenService = potenService; _potenService = potenService;
} }
public async Task RunAsync() public async Task RunAsync() {
{
// read field data from separate json file // read field data from separate json file
var VRAPotenInputJson = File.ReadAllText("PotenInput.json"); var VRAPotenInputJson = File.ReadAllText("PotenInput.json");
List<PotenInput> potenInputs = JsonConvert.DeserializeObject<List<PotenInput>>(VRAPotenInputJson); List<PotenInput> potenInputs = JsonConvert.DeserializeObject<List<PotenInput>>(VRAPotenInputJson);
@ -48,36 +44,31 @@ namespace FarmmapsVRApoten
await _farmmapsApiService.GetCurrentUserCodeAsync(); await _farmmapsApiService.GetCurrentUserCodeAsync();
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync(); var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
foreach (var input in potenInputs) foreach (var input in potenInputs) {
{ try {
try
{
await Process(roots, input); await Process(roots, input);
} } catch (Exception ex) {
catch (Exception ex)
{
_logger.LogError(ex.Message); _logger.LogError(ex.Message);
} }
} }
} }
private async Task Process(List<UserRoot> roots, PotenInput input) private async Task Process(List<UserRoot> roots, PotenInput input) {
{
var meanDensity = input.MeanDensity; var meanDensity = input.MeanDensity;
var variation = input.Variation; var variation = input.Variation;
var fieldName = input.FieldName; var fieldName = input.FieldName;
bool useShadow = input.UseShadow; bool useShadow = input.UseShadow;
bool countPerArea = input.CountPerArea;
var inputLayerName = input.InputLayerName;
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive"); var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
if (myDrive == null) if (myDrive == null) {
{
_logger.LogError("Could not find a needed root item"); _logger.LogError("Could not find a needed root item");
return; return;
} }
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded"); var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
if (uploadedRoot == null) if (uploadedRoot == null) {
{
_logger.LogError("Could not find a needed root item"); _logger.LogError("Could not find a needed root item");
return; return;
} }
@ -88,13 +79,14 @@ namespace FarmmapsVRApoten
$"VRA Poten cropfield {input.OutputFileName}", input.PlantingYear, $"VRA Poten cropfield {input.OutputFileName}", input.PlantingYear,
input.GeometryJson.ToString(Formatting.None)); input.GeometryJson.ToString(Formatting.None));
//Calculating shadow map _logger.LogInformation($"CropfielditemCode: {cropfieldItem.Code}");
if (useShadow)
{
//Downloading shadowMap for own interpretation
if (useShadow) {
_logger.LogInformation("Calculate shadow map for field"); _logger.LogInformation("Calculate shadow map for field");
var shadowItem = await _generalService.RunShadowTask(cropfieldItem); var shadowItem = await _generalService.RunShadowTask(cropfieldItem);
if (shadowItem == null) if (shadowItem == null) {
{
_logger.LogError("Something went wrong while obtaining the shadow map"); _logger.LogError("Something went wrong while obtaining the shadow map");
return; return;
} }
@ -104,21 +96,18 @@ namespace FarmmapsVRApoten
Path.Combine(DownloadFolder, $"{input.OutputFileName}.shadow.zip")); Path.Combine(DownloadFolder, $"{input.OutputFileName}.shadow.zip"));
} }
_logger.LogInformation("Looking for local data to use"); _logger.LogInformation("Looking for local data to use");
var localDataAvailable = input.File; var localDataAvailable = input.File;
var geotiffItem = (Item) null; var geotiffItem = (Item)null;
if (String.IsNullOrEmpty(localDataAvailable)) if (String.IsNullOrEmpty(localDataAvailable)) {
{
_logger.LogInformation("Could not find item for uploaded data, using BOFEK"); _logger.LogInformation("Could not find item for uploaded data, using BOFEK");
//Retreiving BOFEK //Retreiving BOFEK
_logger.LogInformation("Get BOFEK for field"); _logger.LogInformation("Get BOFEK for field");
var bofekItem = await _generalService.RunBofekTask(cropfieldItem); var bofekItem = await _generalService.RunBofekTask(cropfieldItem);
if (bofekItem == null) if (bofekItem == null) {
{
_logger.LogError("Something went wrong while obtaining the BOFEK data"); _logger.LogError("Something went wrong while obtaining the BOFEK data");
return; return;
} }
@ -126,10 +115,7 @@ namespace FarmmapsVRApoten
_logger.LogInformation("Downloading Bofek map"); _logger.LogInformation("Downloading Bofek map");
await _farmmapsApiService.DownloadItemAsync(bofekItem.Code, await _farmmapsApiService.DownloadItemAsync(bofekItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.BOFEK.zip")); Path.Combine(DownloadFolder, $"{input.OutputFileName}.BOFEK.zip"));
} } else if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) {
else if (input.File.Contains(".tif") || input.File.Contains(".geotiff")) {
_logger.LogInformation("input = tiff data"); _logger.LogInformation("input = tiff data");
var dataPath = Path.Combine("Data", input.File); var dataPath = Path.Combine("Data", input.File);
geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath, geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath,
@ -139,20 +125,16 @@ namespace FarmmapsVRApoten
_logger.LogError("Could not find item for uploaded data"); _logger.LogError("Could not find item for uploaded data");
return; return;
} }
} } else {
else
{
var isGeoJson = input.File.Contains("json"); var isGeoJson = input.File.Contains("json");
var dataPath = Path.Combine("Data", input.File); var dataPath = Path.Combine("Data", input.File);
var shapeItem = isGeoJson var shapeItem = isGeoJson
? await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath, ? await _generalService.UploadDataAsync(uploadedRoot, SHAPE_PROCESSED_ITEMTYPE, dataPath,
Path.GetFileNameWithoutExtension(input.File)) Path.GetFileNameWithoutExtension(input.File))
: await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, : await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath,
Path.GetFileNameWithoutExtension(input.File)); Path.GetFileNameWithoutExtension(input.File), input.GeometryJson.ToString(Formatting.None));
if (shapeItem == null) if (shapeItem == null) {
{
_logger.LogError("Something went wrong while searching for the shape file"); _logger.LogError("Something went wrong while searching for the shape file");
return; return;
} }
@ -161,8 +143,10 @@ namespace FarmmapsVRApoten
_logger.LogInformation($"Converting shape to geotiff"); _logger.LogInformation($"Converting shape to geotiff");
geotiffItem = await _generalService.ShapeToGeotiff(shapeItem); geotiffItem = await _generalService.ShapeToGeotiff(shapeItem);
if (geotiffItem == null) _logger.LogInformation($"ShapeToGeotiff_GeotiffItemcode: {geotiffItem.Code}");
{
if (geotiffItem == null) {
_logger.LogError("Something went wrong with shape to geotiff transformation"); _logger.LogError("Something went wrong with shape to geotiff transformation");
return; return;
} }
@ -172,15 +156,16 @@ namespace FarmmapsVRApoten
Path.Combine(DownloadFolder, $"VRApoten_inputGeotiff_{input.OutputFileName}.zip")); Path.Combine(DownloadFolder, $"VRApoten_inputGeotiff_{input.OutputFileName}.zip"));
} }
// create appliance map // create appliance map
_logger.LogInformation("Calculating application map"); _logger.LogInformation("Calculating application map");
// INPUT IS NEEDED as GEOTIFF // INPUT IS NEEDED as GEOTIFF
var applianceMapItem = var applianceMapItem =
await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation); await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea, useShadow, inputLayerName);
if (applianceMapItem == null) if (applianceMapItem == null) {
{
return; return;
} }
@ -193,17 +178,49 @@ namespace FarmmapsVRApoten
? "Download application map completed." ? "Download application map completed."
: "Something went wrong while downloading."); : "Something went wrong while downloading.");
_logger.LogInformation($"Converting geotiff to shape");
var taskmap = await _generalService.GeotiffToShape(applianceMapItem);
if(input.GenerateTaskmap) {
//GEOTIFF TO Taskmap
_logger.LogInformation($"Converting geotiff to taskmap");
var taskmap = (Item)null;
if (input.OutputType == "isoxml")
{
if (input.DdiCode == null)
{
_logger.LogInformation("DDi not given. Using expected identifiers");
if (countPerArea == true) {input.DdiCode = input.DdiCode = "0011";}
else { input.DdiCode = "0016"; };
}
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: "3", unitScale: null, maximumClasses: input.MaximumClasses);
} else
{
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);
}
if (taskmap == null) if (taskmap == null)
{ {
_logger.LogError("Something went wrong with geotiff to shape transformation"); _logger.LogError("Something went wrong with geotiff to taskmap transformation");
return; return;
} }
_logger.LogInformation("Downloading taskmap"); _logger.LogInformation("Downloading taskmap");
await _farmmapsApiService.DownloadItemAsync(taskmap.Code, await _farmmapsApiService.DownloadItemAsync(taskmap.Code,
Path.Combine(DownloadFolder, $"VRApoten_taskmap_{input.OutputFileName}.zip")); Path.Combine(DownloadFolder, $"VRApoten_taskmap_{input.OutputFileName}_isoxml.zip"));
}
} }
} }
} }

View File

@ -1,13 +1,15 @@
[ [
{ {
"File": "PlantingSampleDataLutum.zip", "File": "PlantingSampleDataLutum.zip",
//"File": "Lutum_SampleDataPlanting.zip", //"InputLayerName": "EC0-60",
"OutputFileName": "vraPoten_SampleData", "OutputFileName": "2021.06.09_vraPoten_SampleData",
"FieldName": "lutum", "FieldName": "lutum",
"PlantingYear": 2020, "PlantingYear": 2021,
"MeanDensity": "30", "MeanDensity": "30",
"Variation": "20", "Variation": "20",
"UseShadow": false, "UseShadow": false,
"CountPerArea": true, // don't forget to change ddi if isoxml is created
"geometryJson": { "geometryJson": {
"type": "Polygon", "type": "Polygon",
"coordinates": [ "coordinates": [
@ -19,6 +21,33 @@
[ 5.66886041703652044, 52.52929999060298627 ] [ 5.66886041703652044, 52.52929999060298627 ]
] ]
] ]
},
"GenerateTaskmap": true,
"OutputType": "shape", // "shape" or "isoxml" if isoxml also add ddiCode
"Precision": "2",
"MaximumClasses": "5",
"DdiCode": "0016", // DDI 0011 for count per area; DDI 0016 for distance (CM)
"CellWidth": "3",
"CellHeight": "10",
"Centered": "true",
"StartPoint": {
"type": "Point",
//"coordinates": [ 5.66886041703652044, 52.52929999060298627 ] // 1
//"coordinates": [ 5.6716230923214912, 52.52946316399909676 ] // 2
//"coordinates": [ 5.67185376229668581, 52.5280565894154563 ] // 3
"coordinates": [ 5.66903207841337231, 52.52790646510525363 ] // 4
},
"EndPoint": {
"type": "Point",
"coordinates": [ 5.66886041703652044, 52.52929999060298627 ] // 1
//"coordinates": [ 5.6716230923214912, 52.52946316399909676 ] // 2
//"coordinates": [ 5.67185376229668581, 52.5280565894154563 ] // 3
//"coordinates": [ 5.66903207841337231, 52.52790646510525363 ] // 4
} // if no angle
//"Angle": "317.0" // if no endpoint
} }
}
] ]

View File

@ -25,24 +25,16 @@ namespace FarmmapsVRApoten
_generalService = generalService; _generalService = generalService;
} }
public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem,string meanDensity, string variation) public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea, bool useShadow, string inputLayerName = null)
{ {
var potenApplicationMapRequest = new TaskRequest() { TaskType = VRAPLANTING_TASK }; var potenApplicationMapRequest = new TaskRequest() { TaskType = VRAPLANTING_TASK };
if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; } if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; }
potenApplicationMapRequest.attributes["meanDensity"] = meanDensity; potenApplicationMapRequest.attributes["meanDensity"] = meanDensity;
potenApplicationMapRequest.attributes["variation"] = variation; potenApplicationMapRequest.attributes["variation"] = variation;
potenApplicationMapRequest.attributes["variation"] = variation;
//var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest); potenApplicationMapRequest.attributes["countPerArea"] = countPerArea.ToString();
//await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) => potenApplicationMapRequest.attributes["useShadow"] = useShadow.ToString();
//{ potenApplicationMapRequest.attributes["inputLayerName"] = inputLayerName;
// _logger.LogInformation("Checking VRAPoten task status");
// var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode);
// // Code
// if (itemTaskStatus.IsFinished)
// tokenSource.Cancel();
//});
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest); var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest);
_logger.LogInformation($"itemTaskCode: {taskCode}"); _logger.LogInformation($"itemTaskCode: {taskCode}");
@ -50,8 +42,6 @@ namespace FarmmapsVRApoten
_logger.LogInformation($"potenTaskmapRequest type: {potenApplicationMapRequest.TaskType}"); _logger.LogInformation($"potenTaskmapRequest type: {potenApplicationMapRequest.TaskType}");
_logger.LogInformation($"cropfieldItemCode: {cropfieldItem.Code}"); _logger.LogInformation($"cropfieldItemCode: {cropfieldItem.Code}");
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => { await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode);
_logger.LogInformation($"Waiting on calculation of application map; Status: {itemTaskStatus.State}"); _logger.LogInformation($"Waiting on calculation of application map; Status: {itemTaskStatus.State}");
@ -60,7 +50,6 @@ namespace FarmmapsVRApoten
}); });
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode);
if (itemTask.State == ItemTaskState.Error) if (itemTask.State == ItemTaskState.Error)
{ {
@ -84,7 +73,6 @@ namespace FarmmapsVRApoten
} }
} }
} }

View File

@ -0,0 +1,45 @@
{
"type": "FeatureCollection",
"name": "Points",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.1 }, "geometry": { "type": "Point", "coordinates": [ 5.670697160803186, 52.529191329839897 ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.97 }, "geometry": { "type": "Point", "coordinates": [ 5.671065563240634, 52.529190448643625 ] } },
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.09 }, "geometry": { "type": "Point", "coordinates": [ 5.671433965661168, 52.5291895663036 ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.29 }, "geometry": { "type": "Point", "coordinates": [ 5.669222114450619, 52.528970163883578 ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.05 }, "geometry": { "type": "Point", "coordinates": [ 5.669590515080236, 52.528969287267856 ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.35 }, "geometry": { "type": "Point", "coordinates": [ 5.669958915693023, 52.528968409508401 ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.59 }, "geometry": { "type": "Point", "coordinates": [ 5.670327316288964, 52.528967530605286 ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.16 }, "geometry": { "type": "Point", "coordinates": [ 5.670695716868035, 52.528966650558438 ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.57 }, "geometry": { "type": "Point", "coordinates": [ 5.671064117430213, 52.528965769367922 ] } },
{ "type": "Feature", "properties": { "Data_whole": 6, "Data_decimal": 0.4 }, "geometry": { "type": "Point", "coordinates": [ 5.671432517975476, 52.528964887033666 ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.32 }, "geometry": { "type": "Point", "coordinates": [ 5.669220678033353, 52.528745484567601 ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.16 }, "geometry": { "type": "Point", "coordinates": [ 5.669589076787721, 52.528744607957577 ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.36 }, "geometry": { "type": "Point", "coordinates": [ 5.669957475525263, 52.528743730203921 ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.33 }, "geometry": { "type": "Point", "coordinates": [ 5.670325874245955, 52.528742851306561 ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.86 }, "geometry": { "type": "Point", "coordinates": [ 5.670694272949777, 52.528741971265497 ] } },
{ "type": "Feature", "properties": { "Data_whole": 6, "Data_decimal": 0.61 }, "geometry": { "type": "Point", "coordinates": [ 5.671062671636706, 52.528741090080729 ] } },
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.7 }, "geometry": { "type": "Point", "coordinates": [ 5.671431070306722, 52.528740207752286 ] } },
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.73 }, "geometry": { "type": "Point", "coordinates": [ 5.669219241632893, 52.528520805240142 ] } },
{ "type": "Feature", "properties": { "Data_whole": 5, "Data_decimal": 0.54 }, "geometry": { "type": "Point", "coordinates": [ 5.669587638512033, 52.528519928635895 ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.11 }, "geometry": { "type": "Point", "coordinates": [ 5.669956035374347, 52.528519050887994 ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.41 }, "geometry": { "type": "Point", "coordinates": [ 5.670324432219813, 52.528518171996353 ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.17 }, "geometry": { "type": "Point", "coordinates": [ 5.670692829048409, 52.52851729196108 ] } },
{ "type": "Feature", "properties": { "Data_whole": 5, "Data_decimal": 0.8 }, "geometry": { "type": "Point", "coordinates": [ 5.671061225860114, 52.528516410782132 ] } },
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.11 }, "geometry": { "type": "Point", "coordinates": [ 5.671429622654903, 52.528515528459451 ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.31 }, "geometry": { "type": "Point", "coordinates": [ 5.669217805249236, 52.528296125901214 ] } },
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.07 }, "geometry": { "type": "Point", "coordinates": [ 5.669586200253172, 52.528295249302751 ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.54 }, "geometry": { "type": "Point", "coordinates": [ 5.669954595240281, 52.528294371560584 ] } },
{ "type": "Feature", "properties": { "Data_whole": 8, "Data_decimal": 0.82 }, "geometry": { "type": "Point", "coordinates": [ 5.670322990210543, 52.528293492674734 ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.54 }, "geometry": { "type": "Point", "coordinates": [ 5.670691385163935, 52.528292612645224 ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.35 }, "geometry": { "type": "Point", "coordinates": [ 5.671059780100435, 52.528291731472009 ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.35 }, "geometry": { "type": "Point", "coordinates": [ 5.671428175020021, 52.528290849155169 ] } },
{ "type": "Feature", "properties": { "Data_whole": 8, "Data_decimal": 0.13 }, "geometry": { "type": "Point", "coordinates": [ 5.669216368882385, 52.528071446550889 ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.51 }, "geometry": { "type": "Point", "coordinates": [ 5.669584762011135, 52.528070569958146 ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.52 }, "geometry": { "type": "Point", "coordinates": [ 5.669953155123062, 52.528069692221734 ] } },
{ "type": "Feature", "properties": { "Data_whole": 8, "Data_decimal": 0.86 }, "geometry": { "type": "Point", "coordinates": [ 5.670321548218141, 52.528068813341662 ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.54 }, "geometry": { "type": "Point", "coordinates": [ 5.670689941296351, 52.528067933317907 ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.54 }, "geometry": { "type": "Point", "coordinates": [ 5.671058334357669, 52.528067052150526 ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.33 }, "geometry": { "type": "Point", "coordinates": [ 5.671426727402074, 52.528066169839413 ] } }
]
}

View File

@ -0,0 +1,40 @@
{
"type": "FeatureCollection",
"name": "Polygons",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.17 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670445415146707, 52.529088625025459 ], [ 5.670436500109911, 52.529205353741368 ], [ 5.67100275425158, 52.529226856274043 ], [ 5.670445415146707, 52.529088625025459 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.17 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670474664765167, 52.528705646190737 ], [ 5.670509421984359, 52.528695389390876 ], [ 5.670475899473076, 52.528689479586824 ], [ 5.670474664765167, 52.528705646190737 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 8, "Data_decimal": 0.66 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670529486595214, 52.527987838516857 ], [ 5.670513853610409, 52.528192528445118 ], [ 5.671080652223759, 52.528222889234513 ], [ 5.671037195788521, 52.52802077466923 ], [ 5.670529486595214, 52.527987838516857 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 6, "Data_decimal": 0.87 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671088061587392, 52.528257349960555 ], [ 5.670500031678031, 52.528373505423083 ], [ 5.670475899473076, 52.528689479586824 ], [ 5.670509421984359, 52.528695389390876 ], [ 5.67114210124075, 52.528508686753064 ], [ 5.671088061587392, 52.528257349960555 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.97 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671208751860665, 52.528818676769426 ], [ 5.671298932270745, 52.529238103127824 ], [ 5.671622542615743, 52.529250391677266 ], [ 5.671678791037005, 52.528901541665995 ], [ 5.671208751860665, 52.528818676769426 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 8, "Data_decimal": 0.34 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671805511114944, 52.528115629819482 ], [ 5.671223720783484, 52.528230552757869 ], [ 5.671782157848563, 52.528260465657667 ], [ 5.671805511114944, 52.528115629819482 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.93 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671223720783484, 52.528230552757869 ], [ 5.671088061587392, 52.528257349960555 ], [ 5.67114210124075, 52.528508686753064 ], [ 5.671772111651965, 52.528322771687201 ], [ 5.671782157848563, 52.528260465657667 ], [ 5.671223720783484, 52.528230552757869 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.88 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669598765293697, 52.528964122725455 ], [ 5.669756159705026, 52.52891767588612 ], [ 5.66960263338403, 52.528879598286942 ], [ 5.669598765293697, 52.528964122725455 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.65 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.66964340911196, 52.528542716867584 ], [ 5.669617818752811, 52.528547771814544 ], [ 5.66960263338403, 52.528879598286942 ], [ 5.669756159705026, 52.52891767588612 ], [ 5.670010186520852, 52.528842712978594 ], [ 5.670075070608809, 52.528618816025038 ], [ 5.66964340911196, 52.528542716867584 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.12 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669646065617165, 52.527930529158823 ], [ 5.669636227085067, 52.52814551803705 ], [ 5.670203425137223, 52.528175900222543 ], [ 5.670262935417118, 52.527970546787003 ], [ 5.669646065617165, 52.527930529158823 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.36 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670124673219705, 52.528447651201468 ], [ 5.66964340911196, 52.528542716867584 ], [ 5.670075070608809, 52.528618816025038 ], [ 5.670124673219705, 52.528447651201468 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.25 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.66997288555807, 52.528971428233667 ], [ 5.669910879416426, 52.5291853941944 ], [ 5.670436500109911, 52.529205353741368 ], [ 5.670445415146707, 52.529088625025459 ], [ 5.66997288555807, 52.528971428233667 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.32 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670010186520852, 52.528842712978594 ], [ 5.670474664765167, 52.528705646190737 ], [ 5.670475899473076, 52.528689479586824 ], [ 5.670075070608809, 52.528618816025038 ], [ 5.670010186520852, 52.528842712978594 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 5, "Data_decimal": 0.41 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670262935417118, 52.527970546787003 ], [ 5.670203425137223, 52.528175900222543 ], [ 5.670513853610409, 52.528192528445118 ], [ 5.670529486595214, 52.527987838516857 ], [ 5.670262935417118, 52.527970546787003 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.8 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670500031678031, 52.528373505423083 ], [ 5.670124673219705, 52.528447651201468 ], [ 5.670075070608809, 52.528618816025038 ], [ 5.670475899473076, 52.528689479586824 ], [ 5.670500031678031, 52.528373505423083 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.35 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.668970013365158, 52.529149666415094 ], [ 5.669598765293697, 52.528964122725455 ], [ 5.66960263338403, 52.528879598286942 ], [ 5.668980939909752, 52.528725405867227 ], [ 5.668923420100609, 52.52914789711555 ], [ 5.668970013365158, 52.529149666415094 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.69 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669617818752811, 52.528547771814544 ], [ 5.668988191186747, 52.528672144197635 ], [ 5.668980939909752, 52.528725405867227 ], [ 5.66960263338403, 52.528879598286942 ], [ 5.669617818752811, 52.528547771814544 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.43 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669636227085067, 52.52814551803705 ], [ 5.669646065617165, 52.527930529158823 ], [ 5.669094033437861, 52.527894717682074 ], [ 5.669064060973, 52.528114869735482 ], [ 5.669636227085067, 52.52814551803705 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 6, "Data_decimal": 0.6 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669618253034461, 52.528538282012228 ], [ 5.669636227085067, 52.52814551803705 ], [ 5.669064060973, 52.528114869735482 ], [ 5.669020756513456, 52.528432947202063 ], [ 5.669618253034461, 52.528538282012228 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.39 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670509421984359, 52.528695389390876 ], [ 5.670474664765167, 52.528705646190737 ], [ 5.670445415146707, 52.529088625025459 ], [ 5.67100275425158, 52.529226856274043 ], [ 5.671298932270745, 52.529238103127824 ], [ 5.671208751860665, 52.528818676769426 ], [ 5.670509421984359, 52.528695389390876 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 3, "Data_decimal": 0.93 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.67114210124075, 52.528508686753064 ], [ 5.670509421984359, 52.528695389390876 ], [ 5.671208751860665, 52.528818676769426 ], [ 5.67114210124075, 52.528508686753064 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 5, "Data_decimal": 0.2 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671772111651965, 52.528322771687201 ], [ 5.67114210124075, 52.528508686753064 ], [ 5.671208751860665, 52.528818676769426 ], [ 5.671678791037005, 52.528901541665995 ], [ 5.671772111651965, 52.528322771687201 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 6, "Data_decimal": 0.64 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669756159705026, 52.52891767588612 ], [ 5.669598765293697, 52.528964122725455 ], [ 5.669589198259692, 52.529173178902582 ], [ 5.669910879416426, 52.5291853941944 ], [ 5.66997288555807, 52.528971428233667 ], [ 5.669756159705026, 52.52891767588612 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 7, "Data_decimal": 0.2 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670010186520852, 52.528842712978594 ], [ 5.669756159705026, 52.52891767588612 ], [ 5.66997288555807, 52.528971428233667 ], [ 5.670010186520852, 52.528842712978594 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.66 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670474664765167, 52.528705646190737 ], [ 5.670010186520852, 52.528842712978594 ], [ 5.66997288555807, 52.528971428233667 ], [ 5.670445415146707, 52.529088625025459 ], [ 5.670474664765167, 52.528705646190737 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.06 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669598765293697, 52.528964122725455 ], [ 5.668970013365158, 52.529149666415094 ], [ 5.669589198259692, 52.529173178902582 ], [ 5.669598765293697, 52.528964122725455 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.62 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670500031678031, 52.528373505423083 ], [ 5.671088061587392, 52.528257349960555 ], [ 5.671080652223759, 52.528222889234513 ], [ 5.670513853610409, 52.528192528445118 ], [ 5.670500031678031, 52.528373505423083 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 1, "Data_decimal": 0.58 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671223720783484, 52.528230552757869 ], [ 5.671805511114944, 52.528115629819482 ], [ 5.671812693849701, 52.528071082842963 ], [ 5.671037195788521, 52.52802077466923 ], [ 5.671080652223759, 52.528222889234513 ], [ 5.671223720783484, 52.528230552757869 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 2, "Data_decimal": 0.83 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.671088061587392, 52.528257349960555 ], [ 5.671223720783484, 52.528230552757869 ], [ 5.671080652223759, 52.528222889234513 ], [ 5.671088061587392, 52.528257349960555 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 5, "Data_decimal": 0.45 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.669617818752811, 52.528547771814544 ], [ 5.66964340911196, 52.528542716867584 ], [ 5.669618253034461, 52.528538282012228 ], [ 5.669617818752811, 52.528547771814544 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 4, "Data_decimal": 0.34 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.66964340911196, 52.528542716867584 ], [ 5.670124673219705, 52.528447651201468 ], [ 5.670203425137223, 52.528175900222543 ], [ 5.669636227085067, 52.52814551803705 ], [ 5.669618253034461, 52.528538282012228 ], [ 5.66964340911196, 52.528542716867584 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 10, "Data_decimal": 0.68 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.670124673219705, 52.528447651201468 ], [ 5.670500031678031, 52.528373505423083 ], [ 5.670513853610409, 52.528192528445118 ], [ 5.670203425137223, 52.528175900222543 ], [ 5.670124673219705, 52.528447651201468 ] ] ] } },
{ "type": "Feature", "properties": { "Data_whole": 9, "Data_decimal": 0.97 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 5.668988191186747, 52.528672144197635 ], [ 5.669617818752811, 52.528547771814544 ], [ 5.669618253034461, 52.528538282012228 ], [ 5.669020756513456, 52.528432947202063 ], [ 5.668988191186747, 52.528672144197635 ] ] ] } }
]
}

Binary file not shown.

Binary file not shown.

View File

@ -9,10 +9,16 @@
<None Update="Data\**\*"> <None Update="Data\**\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="ZoneringInput.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\FarmmapsApi\FarmmapsApi.csproj" /> <ProjectReference Include="..\FarmmapsApi\FarmmapsApi.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Data" />
</ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,4 @@
namespace FarmmapsHaulmkilling.Models namespace FarmmapsZonering.Models
{ {
public class InputParameter public class InputParameter
{ {

View File

@ -3,5 +3,9 @@ namespace FarmmapsHaulmkilling.Models
public class Settings public class Settings
{ {
public string CropfieldItemCode { get; set; } public string CropfieldItemCode { get; set; }
public string CropfieldName { get; set; }
public string SatelliteTaskCode { get; set; }
public string VanDerSatTaskCode { get; set; }
public string WatBalTaskCode { get; set; }
} }
} }

View File

@ -0,0 +1,24 @@
using System;
using Newtonsoft.Json.Linq;
namespace FarmmapsZonering.Models
{
public class ZoneringInput
{
public string InputItemOne { get; set; }
public string InputItemTwo { get; set; }
public string Formula { get; set; }
public string OutputFileName { get; set; }
public string CropFieldName { get; set; }
public string CalculatedLayerName { get; set; }
public string CalculatedQuantity { get; set; }
public string CalculatedUnit { get; set; }
public bool CreateNewCropfield { get; set; }
public int CropYear { get; set; }
public JObject GeometryJson { get; set; }
public bool GetWatBal { get; set; }
public bool GetVanDerSat { get; set; }
public bool storeVanDerSatStatistics { get; set; }
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -40,17 +41,30 @@ namespace FarmmapsZonering
if (!Directory.Exists(DownloadFolder)) if (!Directory.Exists(DownloadFolder))
Directory.CreateDirectory(DownloadFolder); Directory.CreateDirectory(DownloadFolder);
LoadSettings(); // Read input data from separate file
var zoneringInputJson = File.ReadAllText("ZoneringInput.json");
List<ZoneringInput> zoneringInputs = JsonConvert.DeserializeObject<List<ZoneringInput>>(zoneringInputJson);
// !! this call is needed the first time an api is called with a fresh clientid and secret !! // !! this call is needed the first time an api is called with a fresh clientid and secret !!
await _farmmapsApiService.GetCurrentUserCodeAsync(); await _farmmapsApiService.GetCurrentUserCodeAsync();
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync(); var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
// await SimpleAdditionAsync(roots);
await ZoningAsync(roots); foreach (var input in zoneringInputs)
{
try
{
await ZoningAsync(roots, input);
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
}
} }
private async Task SimpleAdditionAsync(List<UserRoot> roots) }
private async Task ZoningAsync(List<UserRoot> roots, ZoneringInput input)
{ {
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive"); var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
if (myDrive == null) if (myDrive == null)
@ -59,6 +73,16 @@ namespace FarmmapsZonering
return; return;
} }
bool useCreatedCropfield = false;
bool GetWatBal = input.GetWatBal;
bool getVanDerSat = input.GetVanDerSat;
bool StoreVanDerSatStatistics = input.storeVanDerSatStatistics;
var FieldName = input.CropFieldName;
string settingsfile = $"Settings_{FieldName}.json";
// Load settings from previous cropfield
LoadSettings(settingsfile);
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded"); var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
if (uploadedRoot == null) if (uploadedRoot == null)
{ {
@ -67,13 +91,18 @@ namespace FarmmapsZonering
} }
Item cropfieldItem; Item cropfieldItem;
if (string.IsNullOrEmpty(_settings.CropfieldItemCode)) if (input.CreateNewCropfield == true) // || string.IsNullOrEmpty(_settings.CropfieldItemCode) ## CHECK IT!!
{ {
_logger.LogInformation("Creating cropfield"); _logger.LogInformation("Creating cropfield");
cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, "Cropfield VRA Zonering", 2020,
@"{ ""type"": ""Polygon"", ""coordinates"": [ [ [ 5.670991253771027, 52.796788997702613 ], [ 5.671526456638633, 52.797291618546666 ], [ 5.671275936147413, 52.797422436717852 ], [ 5.671959173850738, 52.798269302728798 ], [ 5.670649634919365, 52.798778791408822 ], [ 5.671503682048522, 52.799591206957416 ], [ 5.675159003761311, 52.798193567415474 ], [ 5.673029579585948, 52.796024727480535 ], [ 5.670991253771027, 52.796788997702613 ] ] ] }");
cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, input.CropFieldName, input.CropYear,
input.GeometryJson.ToString(Formatting.None));
_settings.CropfieldName = cropfieldItem.Name;
_settings.CropfieldItemCode = cropfieldItem.Code; _settings.CropfieldItemCode = cropfieldItem.Code;
SaveSettings(); SaveSettings(settingsfile);
} }
else else
{ {
@ -81,127 +110,104 @@ namespace FarmmapsZonering
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
} }
if (GetWatBal==true) {
////Run watbal
//if (useCreatedCropfield == false || string.IsNullOrEmpty(_settings.WatBalTaskCode)) {
// var WatBalTaskCode = await _generalService.RunWatBalTask(cropfieldItem);
// _settings.WatBalTaskCode = WatBalTaskCode;
// SaveSettings(settingsfile);
//}
//// Get watbal data
//Item WatBalItem = await _generalService.FindWatBalItem(cropfieldItem, _settings.WatBalTaskCode, FieldName, StoreStatistics);
}
if (getVanDerSat==true) {
// 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, StoreVanDerSatStatistics);
// download the geotiff
_logger.LogInformation("Downloading geotiff file");
await _farmmapsApiService.DownloadItemAsync(VanDerSatItem.Code,
Path.Combine(DownloadFolder, $"nbs_VanDerSatGeotiff_{input.OutputFileName}.zip"));
}
var inputOneItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, var inputOneItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
Path.Combine("Data", "data_9001.tif"),"data_9001"); Path.Combine("Data", $"{input.InputItemOne}"), Path.GetFileNameWithoutExtension($"{input.InputItemOne}"));
if (inputOneItem == null) {
_logger.LogError("Could not find item for uploaded data");
return;
}
var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, if (inputOneItem == null)
Path.Combine("Data", "data_times_two_4326.tiff"), "data_times_two_4326");
if (inputTwoItem == null) {
_logger.LogError("Could not find item for uploaded data");
return;
}
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, "[0] + [1]", new Output()
{ {
Name = "add", _logger.LogError("Could not find item for uploaded data");
Unit = "n/kg", return;
Quantity = "Nitrogen" }
//var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
// Path.Combine("Data", $"{input.InputItemTwo}"), Path.GetFileNameWithoutExtension($"{input.InputItemTwo}"));
//if (inputTwoItem == null) {
// _logger.LogError("Could not find item for uploaded data");
// return;
//}
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, input.Formula, new Output()
{
Name = input.CalculatedLayerName,
Quantity = input.CalculatedQuantity,
Unit = input.CalculatedUnit,
}, new InputParameter() }, new InputParameter()
{ {
ItemCode = inputOneItem.Code, ItemCode = inputOneItem.Code,
LayerName = inputOneItem.Data["layers"][0]["name"].ToString() LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
}, //},
new InputParameter() //new InputParameter()
{ //{
ItemCode = inputTwoItem.Code, // ItemCode = inputTwoItem.Code,
LayerName = inputTwoItem.Data["layers"][0]["name"].ToString() // LayerName = inputTwoItem.Data["layers"][0]["name"].ToString()
}); });
_logger.LogInformation("Downloading output"); _logger.LogInformation("Downloading output");
_logger.LogInformation($"outputitem: {outputItem} with code {outputItem.Code} and date {outputItem.DataDate}");
await _farmmapsApiService.DownloadItemAsync(outputItem.Code, await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
Path.Combine(DownloadFolder, $"times_2_zonering.zip"));
Path.Combine(DownloadFolder, $"{input.OutputFileName}.zoning.zip"));
} }
private async Task ZoningAsync(List<UserRoot> roots) // Functions to save previously created cropfields
{ private void LoadSettings(string file) {
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive"); if (File.Exists(file)) {
if (myDrive == null) var jsonText = File.ReadAllText(file);
{
_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;
}
Item cropfieldItem;
if (string.IsNullOrEmpty(_settings.CropfieldItemCode))
{
_logger.LogInformation("Creating cropfield");
cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDrive.Code, "Cropfield VRA Zonering", 2020,
@"{ ""type"": ""Polygon"", ""coordinates"": [ [ [ 5.670991253771027, 52.796788997702613 ], [ 5.671526456638633, 52.797291618546666 ], [ 5.671275936147413, 52.797422436717852 ], [ 5.671959173850738, 52.798269302728798 ], [ 5.670649634919365, 52.798778791408822 ], [ 5.671503682048522, 52.799591206957416 ], [ 5.675159003761311, 52.798193567415474 ], [ 5.673029579585948, 52.796024727480535 ], [ 5.670991253771027, 52.796788997702613 ] ] ] }");
_settings.CropfieldItemCode = cropfieldItem.Code;
SaveSettings();
}
else
{
_logger.LogInformation("Cropfield already exists trying to get");
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
}
var inputOneItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
Path.Combine("Data", "data_9001.tif"),"data_9001");
if (inputOneItem == null) {
_logger.LogError("Could not find item for uploaded data");
return;
}
var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,
Path.Combine("Data", "data_times_two_4326.tiff"), "data_times_two_4326");
if (inputTwoItem == null) {
_logger.LogError("Could not find item for uploaded data");
return;
}
var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, "if [0] >= 1.28 then [1] else 0", new Output()
{
Name = "Remove",
Unit = "m&m",
Quantity = "Nonsense"
}, new InputParameter()
{
ItemCode = inputOneItem.Code,
LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
},
new InputParameter()
{
ItemCode = inputTwoItem.Code,
LayerName = inputTwoItem.Data["layers"][0]["name"].ToString()
});
_logger.LogInformation("Downloading output");
await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
Path.Combine(DownloadFolder, $"NonsenseRemove.zip"));
}
private void LoadSettings()
{
if (File.Exists(SettingsFile))
{
var jsonText = File.ReadAllText(SettingsFile);
_settings = JsonConvert.DeserializeObject<Settings>(jsonText); _settings = JsonConvert.DeserializeObject<Settings>(jsonText);
} } else {
else
{
_settings = new Settings(); _settings = new Settings();
} }
} }
private void SaveSettings() private void SaveSettings(string file) {
{
if (_settings == null) if (_settings == null)
return; return;
var json = JsonConvert.SerializeObject(_settings); var json = JsonConvert.SerializeObject(_settings);
File.WriteAllText(SettingsFile, json); File.WriteAllText(file, json);
}
private void SaveInfo(string file) {
if (_settings == null)
return;
var json = JsonConvert.SerializeObject(_settings);
File.WriteAllText(file, json);
} }
} }
} }

View File

@ -0,0 +1,99 @@
[
//Formule kan meerdere inputs aan
// Met blokhaken en een nummer specificeer je een input:
//[0], [10]. etc...
// Aan de hand van de volgorde van input wordt momenteel bepaald welk nummer bij welk input hoort.
//[0] is dus de eerst tiff opgegeven.Als het goed is maakt het nummer nu niks uit, dus als er 2 inputs zijn en in de formule staan[0] en[10] dan zal die nog steeds werken.
//De volgorde van de tiff kun je verslepen, bij de formule inputs kun je de input van het ene[0] slot naar het andere slepen[10]
//Functies: abs, min en max
//Constanten: pi en e
//if ([0] -[1])/ ([0] +[1]) < 0 then 0
//else if ([0] -[1])/ ([0] +[1]) > 1 then 1
//else ([0] -[1]) / ([0] +[1])
//{
// "InputItemOne": "20201106_Sentinel2_L2A_B04.tiff",
// "InputItemTwo": "20201106_Sentinel2_L2A_B08.tiff",
// "Formula": "([1]-[0])/([1]+[0])",
// "CreatedLayerName": "Biomassa",
// "CalculatedQuantity": "NDVI",
// "CalculatedUnit": "ndviValue",
// "OutputFileName": "FullField_NDVI",
// "CropFieldName": "FullField",
// "CreateNewCropfield": false,
// "CropYear": 2020,
// "geometryJson": {
// "type": "Polygon",
// "coordinates": [
// [
// [ 4.9593709, 52.8014339 ],
// [ 4.9675488, 52.7943149 ],
// [ 4.9735195, 52.7968665 ],
// [ 4.9667833, 52.8030414 ],
// [ 4.9593709, 52.8014339 ]
// ]
// ]
// }
//,
//{
// "InputItemOne": "data_9001.tif",
// "InputItemTwo": "data_times_two_4326.tiff",
// "Formula": "if [0] >= 1.28 then [1] else 0",
// "CreatedLayerName": "Biomassa",
// "CalculatedQuantity": "NDVI",
// "CalculatedUnit": "ndviValue",
// "OutputFileName": "Zoning",
// "CropFieldName": "Data_whole",
// "UseShadow": false,
// "GetWatBal": false,
// "GetVanDerSat": false,
// "storeVanDerSatStatistics": false,
// "CropYear": 2020,
// "geometryJson": {
// "type": "Polygon",
// "coordinates": [
// [
// [ 5.66886041703652044, 52.52929999060298627 ],
// [ 5.6716230923214912, 52.52946316399909676 ],
// [ 5.67185376229668581, 52.5280565894154563 ],
// [ 5.66903207841337231, 52.52790646510525363 ],
// [ 5.66886041703652044, 52.52929999060298627 ]
// ]
// ]
// }
//},
{
"InputItemOne": "VRApoten_appliancemap_20210215_vraPoten_SampleData_CovertArea.tif",
//"InputItemTwo": "",
"Formula": "((100/[0])/0.75)",
"LayerName": "CountPerAreaConversion",
"CalculatedQuantity": "CountPerArea",
"CalculatedUnit": "#/m2",
"OutputFileName": "CountPerAreaConversionOutput",
"CropFieldName": "ZoningCpA",
"CreateNewCropfield": true,
"UseShadow": false,
"GetWatBal": false,
"GetVanDerSat": false,
"storeVanDerSatStatistics": false,
"CropYear": 2020,
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 5.66886041703652044, 52.52929999060298627 ],
[ 5.6716230923214912, 52.52946316399909676 ],
[ 5.67185376229668581, 52.5280565894154563 ],
[ 5.66903207841337231, 52.52790646510525363 ],
[ 5.66886041703652044, 52.52929999060298627 ]
]
]
}
}
]